Created
June 24, 2020 02:43
-
-
Save colin-mccarthy/85b78cf9b26e1d91ad58d535cebacf56 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| - name: Tower Projects | |
| hosts: tower | |
| gather_facts: false | |
| connection: local | |
| collections: | |
| - awx.awx | |
| # organization and state vars are injected via a survey in Ansible Tower. | |
| tasks: | |
| # ORGS | |
| - name: CREATE ORGANIZATION | |
| awx.awx.tower_organization: | |
| name: "{{ organization }}" | |
| description: "{{ organization }}" | |
| tower_username: admin | |
| tower_password: "{{ admin_password }}" | |
| tower_host: "{{ ansible_host }}" | |
| tower_verify_ssl: false | |
| # PROJECTS | |
| - name: ADD REPO INTO TOWER | |
| awx.awx.tower_project: | |
| name: "RHEL Demo" | |
| organization: "{{ organization }}" | |
| scm_type: git | |
| scm_url: "https://github.com/colin-mccarthy/rhel_ansible_demo" | |
| tower_username: admin | |
| tower_password: "{{ admin_password }}" | |
| tower_host: "{{ ansible_host }}" | |
| tower_verify_ssl: false | |
| state: "{{ state }}" | |
| - name: ADD REPO INTO TOWER | |
| awx.awx.tower_project: | |
| name: "Windows Demo" | |
| organization: "{{ organization }}" | |
| scm_type: git | |
| scm_url: "https://github.com/colin-mccarthy/windows_demo" | |
| tower_username: admin | |
| tower_password: "{{ admin_password }}" | |
| tower_host: "{{ ansible_host }}" | |
| tower_verify_ssl: false | |
| state: "{{ state }}" | |
| - name: ADD REPO INTO TOWER | |
| awx.awx.tower_project: | |
| name: "ServiceNow Demo" | |
| organization: "{{ organization }}" | |
| scm_type: git | |
| scm_url: "https://github.com/colin-mccarthy/servicenow_demo" | |
| tower_username: admin | |
| tower_password: "{{ admin_password }}" | |
| tower_host: "{{ ansible_host }}" | |
| tower_verify_ssl: false | |
| state: "{{ state }}" | |
| # TEAMS | |
| - name: CREATE TEAM | |
| awx.awx.tower_team: | |
| name: "RedHatSI" | |
| description: "RedHat SI" | |
| organization: "{{ organization }}" | |
| tower_username: admin | |
| tower_password: "{{ admin_password }}" | |
| tower_host: "{{ ansible_host }}" | |
| tower_verify_ssl: false | |
| state: "{{ state }}" | |
| # PERMISSIONS | |
| - name: ENSURE THAT USER BELONGS TO ORG | |
| awx.awx.tower_role: | |
| user: colin-mccarthy | |
| organization: "{{ organization }}" | |
| role: member | |
| tower_username: admin | |
| tower_password: "{{ admin_password }}" | |
| tower_host: "{{ ansible_host }}" | |
| validate_certs: false | |
| state: "{{ state }}" | |
| - name: ENSURE THAT USER BELONGS TO ORG | |
| awx.awx.tower_role: | |
| user: wtcross | |
| organization: "{{ organization }}" | |
| role: member | |
| tower_username: admin | |
| tower_password: "{{ admin_password }}" | |
| tower_host: "{{ ansible_host }}" | |
| validate_certs: false | |
| state: "{{ state }}" | |
| # CREDENTIALS | |
| - name: ADD SSH credential into Ansible Tower | |
| awx.awx.tower_credential: | |
| username: ec2-user | |
| password: "{{admin_password}}" | |
| name: "Windows Credential" | |
| kind: ssh | |
| organization: "{{ organization }}" | |
| tower_username: admin | |
| tower_password: "{{ admin_password }}" | |
| tower_host: "{{ ansible_host }}" | |
| tower_verify_ssl: false | |
| state: "{{ state }}" | |
| - name: ADD SSH credential into Ansible Tower | |
| awx.awx.tower_credential: | |
| username: ec2-user | |
| password: "{{admin_password}}" | |
| name: "RHEL Credential" | |
| kind: ssh | |
| organization: "{{ organization }}" | |
| tower_username: admin | |
| tower_password: "{{ admin_password }}" | |
| tower_host: "{{ ansible_host }}" | |
| tower_verify_ssl: false | |
| state: "{{ state }}" | |
| # INVENTORYS | |
| - name: CREATE INVENTORY | |
| awx.awx.tower_inventory: | |
| name: "Windows Inventory" | |
| organization: "{{ organization }}" | |
| tower_username: admin | |
| tower_password: "{{ admin_password }}" | |
| tower_host: "{{ ansible_host }}" | |
| tower_verify_ssl: false | |
| register: windows_inventory | |
| until: windows_inventory is success | |
| delay: 3 | |
| retries: 5 | |
| - name: CREATE INVENTORY | |
| awx.awx.tower_inventory: | |
| name: "RHEL Inventory" | |
| organization: "{{ organization }}" | |
| tower_username: admin | |
| tower_password: "{{ admin_password }}" | |
| tower_host: "{{ ansible_host }}" | |
| tower_verify_ssl: false | |
| register: rhel_inventory | |
| until: rhel_inventory is success | |
| delay: 3 | |
| retries: 5 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment