├── .ansible-lint ├── .github ├── FUNDING.yml ├── stale.yml └── workflows │ ├── ci.yml │ └── release.yml ├── .gitignore ├── .yamllint ├── LICENSE ├── README.md ├── defaults └── main.yml ├── meta └── main.yml ├── molecule └── default │ ├── converge.yml │ ├── environment-prep.yml │ ├── molecule.yml │ ├── playbook-no-playbook.yml │ └── requirements.yml ├── tasks ├── awx-install-playbook.yml └── main.yml └── vars ├── Debian.yml └── RedHat.yml /.ansible-lint: -------------------------------------------------------------------------------- 1 | skip_list: 2 | - 'yaml' 3 | - 'role-name' 4 | -------------------------------------------------------------------------------- /.github/FUNDING.yml: -------------------------------------------------------------------------------- 1 | # These are supported funding model platforms 2 | --- 3 | github: geerlingguy 4 | patreon: geerlingguy 5 | -------------------------------------------------------------------------------- /.github/stale.yml: -------------------------------------------------------------------------------- 1 | # Configuration for probot-stale - https://github.com/probot/stale 2 | 3 | # Number of days of inactivity before an Issue or Pull Request becomes stale 4 | daysUntilStale: 90 5 | 6 | # Number of days of inactivity before an Issue or Pull Request with the stale label is closed. 7 | # Set to false to disable. If disabled, issues still need to be closed manually, but will remain marked as stale. 8 | daysUntilClose: 30 9 | 10 | # Only issues or pull requests with all of these labels are check if stale. Defaults to `[]` (disabled) 11 | onlyLabels: [] 12 | 13 | # Issues or Pull Requests with these labels will never be considered stale. Set to `[]` to disable 14 | exemptLabels: 15 | - pinned 16 | - security 17 | - planned 18 | 19 | # Set to true to ignore issues in a project (defaults to false) 20 | exemptProjects: false 21 | 22 | # Set to true to ignore issues in a milestone (defaults to false) 23 | exemptMilestones: false 24 | 25 | # Set to true to ignore issues with an assignee (defaults to false) 26 | exemptAssignees: false 27 | 28 | # Label to use when marking as stale 29 | staleLabel: stale 30 | 31 | # Limit the number of actions per hour, from 1-30. Default is 30 32 | limitPerRun: 30 33 | 34 | pulls: 35 | markComment: |- 36 | This pull request has been marked 'stale' due to lack of recent activity. If there is no further activity, the PR will be closed in another 30 days. Thank you for your contribution! 37 | 38 | Please read [this blog post](https://www.jeffgeerling.com/blog/2020/enabling-stale-issue-bot-on-my-github-repositories) to see the reasons why I mark pull requests as stale. 39 | 40 | unmarkComment: >- 41 | This pull request is no longer marked for closure. 42 | 43 | closeComment: >- 44 | This pull request has been closed due to inactivity. If you feel this is in error, please reopen the pull request or file a new PR with the relevant details. 45 | 46 | issues: 47 | markComment: |- 48 | This issue has been marked 'stale' due to lack of recent activity. If there is no further activity, the issue will be closed in another 30 days. Thank you for your contribution! 49 | 50 | Please read [this blog post](https://www.jeffgeerling.com/blog/2020/enabling-stale-issue-bot-on-my-github-repositories) to see the reasons why I mark issues as stale. 51 | 52 | unmarkComment: >- 53 | This issue is no longer marked for closure. 54 | 55 | closeComment: >- 56 | This issue has been closed due to inactivity. If you feel this is in error, please reopen the issue or file a new issue with the relevant details. 57 | -------------------------------------------------------------------------------- /.github/workflows/ci.yml: -------------------------------------------------------------------------------- 1 | --- 2 | name: CI 3 | 'on': 4 | pull_request: 5 | push: 6 | branches: 7 | - master 8 | schedule: 9 | - cron: "0 3 * * 0" 10 | 11 | defaults: 12 | run: 13 | working-directory: 'geerlingguy.awx' 14 | 15 | jobs: 16 | 17 | lint: 18 | name: Lint 19 | runs-on: ubuntu-latest 20 | steps: 21 | - name: Check out the codebase. 22 | uses: actions/checkout@v2 23 | with: 24 | path: 'geerlingguy.awx' 25 | 26 | - name: Set up Python 3. 27 | uses: actions/setup-python@v2 28 | with: 29 | python-version: '3.x' 30 | 31 | - name: Install test dependencies. 32 | run: pip3 install yamllint 33 | 34 | - name: Lint code. 35 | run: | 36 | yamllint . 37 | 38 | molecule: 39 | name: Molecule 40 | runs-on: ubuntu-latest 41 | strategy: 42 | matrix: 43 | include: 44 | - distro: centos8 45 | playbook: converge.yml 46 | - distro: ubuntu2004 47 | playbook: converge.yml 48 | - distro: centos8 49 | playbook: playbook-no-playbook.yml 50 | 51 | steps: 52 | - name: Check out the codebase. 53 | uses: actions/checkout@v2 54 | with: 55 | path: 'geerlingguy.awx' 56 | 57 | # See: https://github.com/moby/moby/issues/13742#issuecomment-725197223 58 | - name: Force GitHub Actions' docker daemon to use vfs. 59 | run: | 60 | sudo systemctl stop docker 61 | echo '{"cgroup-parent":"/actions_job","storage-driver":"vfs"}' | sudo tee /etc/docker/daemon.json 62 | sudo systemctl start docker 63 | 64 | - name: Set up Python 3. 65 | uses: actions/setup-python@v2 66 | with: 67 | python-version: '3.x' 68 | 69 | - name: Install test dependencies. 70 | run: pip3 install ansible molecule[docker] docker 71 | 72 | - name: Run Molecule tests. 73 | run: molecule test 74 | env: 75 | PY_COLORS: '1' 76 | ANSIBLE_FORCE_COLOR: '1' 77 | MOLECULE_DISTRO: ${{ matrix.distro }} 78 | MOLECULE_PLAYBOOK: ${{ matrix.playbook }} 79 | -------------------------------------------------------------------------------- /.github/workflows/release.yml: -------------------------------------------------------------------------------- 1 | --- 2 | # This workflow requires a GALAXY_API_KEY secret present in the GitHub 3 | # repository or organization. 4 | # 5 | # See: https://github.com/marketplace/actions/publish-ansible-role-to-galaxy 6 | # See: https://github.com/ansible/galaxy/issues/46 7 | 8 | name: Release 9 | 'on': 10 | push: 11 | tags: 12 | - '*' 13 | 14 | defaults: 15 | run: 16 | working-directory: 'geerlingguy.awx' 17 | 18 | jobs: 19 | 20 | release: 21 | name: Release 22 | runs-on: ubuntu-latest 23 | steps: 24 | - name: Check out the codebase. 25 | uses: actions/checkout@v2 26 | with: 27 | path: 'geerlingguy.awx' 28 | 29 | - name: Set up Python 3. 30 | uses: actions/setup-python@v2 31 | with: 32 | python-version: '3.x' 33 | 34 | - name: Install Ansible. 35 | run: pip3 install ansible-base 36 | 37 | - name: Trigger a new import on Galaxy. 38 | run: ansible-galaxy role import --api-key ${{ secrets.GALAXY_API_KEY }} $(echo ${{ github.repository }} | cut -d/ -f1) $(echo ${{ github.repository }} | cut -d/ -f2) 39 | -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | *.retry 2 | */__pycache__ 3 | *.pyc 4 | .cache 5 | 6 | -------------------------------------------------------------------------------- /.yamllint: -------------------------------------------------------------------------------- 1 | --- 2 | extends: default 3 | 4 | rules: 5 | line-length: 6 | max: 120 7 | level: warning 8 | 9 | ignore: | 10 | .github/stale.yml 11 | -------------------------------------------------------------------------------- /LICENSE: -------------------------------------------------------------------------------- 1 | The MIT License (MIT) 2 | 3 | Copyright (c) 2017 Jeff Geerling 4 | 5 | Permission is hereby granted, free of charge, to any person obtaining a copy of 6 | this software and associated documentation files (the "Software"), to deal in 7 | the Software without restriction, including without limitation the rights to 8 | use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of 9 | the Software, and to permit persons to whom the Software is furnished to do so, 10 | subject to the following conditions: 11 | 12 | The above copyright notice and this permission notice shall be included in all 13 | copies or substantial portions of the Software. 14 | 15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS 17 | FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR 18 | COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER 19 | IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN 20 | CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. 21 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # Ansible Role: AWX (open source Ansible Tower) 2 | 3 | > **DEPRECATED**: This role has been deprecated. AWX installation is a lot different than it was when I first created the role, and continues evolving. Please follow the official install guide and if you need automation around it, please consider the [awx-operator](https://github.com/ansible/awx-operator). 4 | 5 | [![CI](https://github.com/geerlingguy/ansible-role-awx/workflows/CI/badge.svg?event=push)](https://github.com/geerlingguy/ansible-role-awx/actions?query=workflow%3ACI) 6 | 7 | Installs and configures [AWX](https://github.com/ansible/awx), the open source version of [Ansible Tower](https://www.ansible.com/tower). 8 | 9 | ## Requirements 10 | 11 | Before this role runs, assuming you want the role to completely set up AWX using it's included installer, you need to make sure the following AWX dependencies are installed: 12 | 13 | | Dependency | Suggested Role | 14 | | ----------------------------- | ------------------------ | 15 | | EPEL repo (RedHat OSes only) | `geerlingguy.repo-epel` | 16 | | Git | `geerlingguy.git` | 17 | | Ansible | `geerlingguy.ansible` | 18 | | Docker | `geerlingguy.docker` | 19 | | Python Pip | `geerlingguy.pip` | 20 | | Node.js (10.x) | `geerlingguy.nodejs` | 21 | 22 | See this role's [`molecule/default/converge.yml`](molecule/default/converge.yml) playbook for an example that works across many different OSes. 23 | 24 | ## Role Variables 25 | 26 | Available variables are listed below, along with default values (see `defaults/main.yml`): 27 | 28 | awx_repo: https://github.com/ansible/awx.git 29 | awx_repo_dir: "~/awx" 30 | awx_version: devel 31 | awx_keep_updated: true 32 | 33 | Variables to control what version of AWX is checked out and installed. 34 | 35 | awx_run_install_playbook: true 36 | 37 | By default, this role will run the installation playbook included with AWX (which builds a set of containers and runs them). You can disable the playbook run by setting this variable to `false`. 38 | 39 | ## Dependencies 40 | 41 | None. 42 | 43 | ## Example Playbook 44 | 45 | ```yaml 46 | - hosts: awx-centos 47 | become: true 48 | 49 | vars: 50 | nodejs_version: "10.x" 51 | docker_install_compose: false 52 | pip_install_packages: 53 | - name: docker 54 | - name: docker-compose 55 | 56 | roles: 57 | - geerlingguy.repo-epel 58 | - geerlingguy.git 59 | - geerlingguy.pip 60 | - geerlingguy.ansible 61 | - geerlingguy.docker 62 | - geerlingguy.nodejs 63 | - geerlingguy.awx 64 | ``` 65 | 66 | After AWX is installed, you can log in with the default username `admin` and password `password`. 67 | 68 | ## License 69 | 70 | MIT / BSD 71 | 72 | ## Author Information 73 | 74 | This role was created in 2017 by [Jeff Geerling](https://www.jeffgeerling.com/), author of [Ansible for DevOps](https://www.ansiblefordevops.com/). 75 | -------------------------------------------------------------------------------- /defaults/main.yml: -------------------------------------------------------------------------------- 1 | --- 2 | awx_repo: https://github.com/ansible/awx.git 3 | awx_repo_dir: "~/awx" 4 | awx_version: devel 5 | awx_keep_updated: true 6 | awx_run_install_playbook: true 7 | postgres_data_dir: /var/lib/pgdocker 8 | -------------------------------------------------------------------------------- /meta/main.yml: -------------------------------------------------------------------------------- 1 | --- 2 | dependencies: [] 3 | 4 | galaxy_info: 5 | role_name: awx 6 | author: geerlingguy 7 | description: "Installs and configures AWX (Ansible Tower's open source version)." 8 | company: "Midwestern Mac, LLC" 9 | license: "license (BSD, MIT)" 10 | min_ansible_version: 2.8 11 | platforms: 12 | - name: EL 13 | versions: 14 | - 7 15 | - 8 16 | - name: Fedora 17 | versions: 18 | - all 19 | - name: Ubuntu 20 | versions: 21 | - all 22 | - name: Debian 23 | versions: 24 | - all 25 | galaxy_tags: 26 | - automation 27 | - system 28 | - web 29 | - django 30 | - awx 31 | - ansible 32 | - tower 33 | - playbook 34 | - ci 35 | - cd 36 | -------------------------------------------------------------------------------- /molecule/default/converge.yml: -------------------------------------------------------------------------------- 1 | --- 2 | - name: Converge 3 | hosts: all 4 | become: true 5 | 6 | vars: 7 | nodejs_version: "10.x" 8 | nodejs_install_npm_user: root 9 | ansible_install_method: "pip" 10 | docker_install_compose: false 11 | pip_install_packages: 12 | - name: docker 13 | - name: docker-compose 14 | 15 | pre_tasks: 16 | - include_tasks: environment-prep.yml 17 | 18 | roles: 19 | - role: geerlingguy.repo-epel 20 | when: ansible_os_family == 'RedHat' 21 | - geerlingguy.git 22 | - geerlingguy.pip 23 | - geerlingguy.ansible 24 | - geerlingguy.docker 25 | - geerlingguy.nodejs 26 | - geerlingguy.awx 27 | -------------------------------------------------------------------------------- /molecule/default/environment-prep.yml: -------------------------------------------------------------------------------- 1 | --- 2 | - name: Update apt cache. 3 | apt: update_cache=yes cache_valid_time=600 4 | when: ansible_os_family == 'Debian' 5 | changed_when: false 6 | 7 | - name: Update $PATH. 8 | lineinfile: 9 | path: /etc/environment 10 | line: 'PATH="/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/local/lib/npm/bin"' 11 | insertafter: EOF 12 | when: ansible_os_family == 'RedHat' 13 | -------------------------------------------------------------------------------- /molecule/default/molecule.yml: -------------------------------------------------------------------------------- 1 | --- 2 | dependency: 3 | name: galaxy 4 | driver: 5 | name: docker 6 | platforms: 7 | - name: instance 8 | image: "geerlingguy/docker-${MOLECULE_DISTRO:-centos7}-ansible:latest" 9 | command: ${MOLECULE_DOCKER_COMMAND:-""} 10 | volumes: 11 | - /sys/fs/cgroup:/sys/fs/cgroup:ro 12 | privileged: true 13 | pre_build_image: true 14 | provisioner: 15 | name: ansible 16 | playbooks: 17 | converge: ${MOLECULE_PLAYBOOK:-converge.yml} 18 | -------------------------------------------------------------------------------- /molecule/default/playbook-no-playbook.yml: -------------------------------------------------------------------------------- 1 | --- 2 | - name: Converge 3 | hosts: all 4 | become: true 5 | 6 | vars: 7 | awx_run_install_playbook: false 8 | 9 | pre_tasks: 10 | - include_tasks: environment-prep.yml 11 | 12 | roles: 13 | - geerlingguy.git 14 | - geerlingguy.awx 15 | -------------------------------------------------------------------------------- /molecule/default/requirements.yml: -------------------------------------------------------------------------------- 1 | --- 2 | - src: geerlingguy.repo-epel 3 | - src: geerlingguy.git 4 | - src: geerlingguy.ansible 5 | - src: geerlingguy.docker 6 | - src: geerlingguy.pip 7 | - src: geerlingguy.nodejs 8 | -------------------------------------------------------------------------------- /tasks/awx-install-playbook.yml: -------------------------------------------------------------------------------- 1 | --- 2 | - name: Check if playbook has been run before. 3 | stat: 4 | path: /etc/awx_playbook_complete 5 | register: awx_playbook_already_run 6 | 7 | - name: Run the AWX installation playbook. 8 | command: "ansible-playbook -i inventory install.yml -e postgres_data_dir={{ postgres_data_dir }}" 9 | args: 10 | chdir: "{{ awx_repo_dir }}/installer" 11 | creates: /etc/awx_playbook_complete 12 | 13 | - name: Create a file to mark whether this playbook has completed. 14 | file: 15 | path: /etc/awx_playbook_complete 16 | state: touch 17 | changed_when: false 18 | 19 | # The following tasks are required due to race condition on first install. See: 20 | # https://github.com/ansible/awx/issues/8387#issuecomment-724873700 21 | - name: Pause for 30 seconds to permit awx_task to start 22 | pause: 23 | seconds: 30 24 | when: not awx_playbook_already_run.stat.exists 25 | 26 | - name: Restart container service 27 | service: 28 | name: docker 29 | state: restarted 30 | when: not awx_playbook_already_run.stat.exists 31 | -------------------------------------------------------------------------------- /tasks/main.yml: -------------------------------------------------------------------------------- 1 | --- 2 | - name: Include OS-specific variables. 3 | include_vars: "{{ ansible_os_family }}.yml" 4 | 5 | - name: Install AWX dependencies. 6 | package: 7 | name: "{{ item }}" 8 | state: present 9 | with_items: "{{ awx_package_dependencies }}" 10 | 11 | - name: Clone AWX into configured directory. 12 | git: 13 | repo: "{{ awx_repo }}" 14 | dest: "{{ awx_repo_dir }}" 15 | version: "{{ awx_version }}" 16 | update: "{{ awx_keep_updated }}" 17 | force: true 18 | accept_hostkey: true 19 | 20 | - include: awx-install-playbook.yml 21 | when: awx_run_install_playbook 22 | -------------------------------------------------------------------------------- /vars/Debian.yml: -------------------------------------------------------------------------------- 1 | --- 2 | awx_package_dependencies: 3 | - build-essential 4 | - gettext 5 | - g++ 6 | - bzip2 7 | -------------------------------------------------------------------------------- /vars/RedHat.yml: -------------------------------------------------------------------------------- 1 | --- 2 | awx_package_dependencies: 3 | - '@Development tools' 4 | - gettext 5 | - gcc-c++ 6 | - bzip2 7 | - libselinux-python3 8 | --------------------------------------------------------------------------------