Skip to content

Commit

Permalink
Merge pull request #321 from cradle8810/action_as_containe
Browse files Browse the repository at this point in the history
ansible-play on container
  • Loading branch information
cradle8810 authored Oct 19, 2024
2 parents c036342 + 51ff062 commit 7aba6de
Show file tree
Hide file tree
Showing 2 changed files with 37 additions and 22 deletions.
21 changes: 13 additions & 8 deletions .github/workflows/develop_branch.yml
Original file line number Diff line number Diff line change
Expand Up @@ -84,17 +84,22 @@ jobs:
- skylark
- tm
environment: Staging
container:
image: ghcr.io/ansible/community-ansible-dev-tools:latest
volumes:
- /home/runner/ansible-vault:/tmp:ro
- /home/runner/.ssh:/root/.ssh:ro
steps:
- name: Checkout
uses: actions/checkout@v4

- name: Prepare environments (ansible-galaxy install role)
run: |
ansible-galaxy role install -r requirements.yml --ignore-errors
- name: Prepare environments (ansible-galaxy install collection)
run: |
ansible-galaxy collection install -r requirements.yml --ignore-errors
- name: Restore Caches
uses: actions/cache/restore@v4
with:
path: |
/github/home/.cache/
/github/home/.ansible/
key: cache-ansible-roles

- name: "ansible-playbook -C"
env:
Expand All @@ -104,6 +109,6 @@ jobs:
-i inventories \
-C \
--ssh-extra-args='-o StrictHostKeyChecking=no' \
--vault-password-file ${{ secrets.VAULT_PASSWORD_FILE }} \
--vault-password-file /tmp/${{ secrets.VAULT_PASSWORD_FILE }} \
--extra-vars "ansible_sudo_pass=${{ secrets.SUDO }}" \
${{ matrix.vm }}.yml
38 changes: 24 additions & 14 deletions .github/workflows/main_branch.yml
Original file line number Diff line number Diff line change
Expand Up @@ -83,17 +83,22 @@ jobs:
- skylark
- tm
environment: Production
container:
image: ghcr.io/ansible/community-ansible-dev-tools:latest
volumes:
- /home/runner/ansible-vault:/tmp:ro
- /home/runner/.ssh:/root/.ssh:ro
steps:
- name: Checkout
uses: actions/checkout@v4

- name: Prepare environments (ansible-galaxy install role)
run: |
ansible-galaxy role install -r requirements.yml --ignore-errors
- name: Prepare environments (ansible-galaxy install collection)
run: |
ansible-galaxy collection install -r requirements.yml --ignore-errors
- name: Restore Caches
uses: actions/cache/restore@v4
with:
path: |
/github/home/.cache/
/github/home/.ansible/
key: cache-ansible-roles

- name: "ansible-playbook -C"
env:
Expand Down Expand Up @@ -122,17 +127,22 @@ jobs:
- skylark
- tm
environment: Production
container:
image: ghcr.io/ansible/community-ansible-dev-tools:latest
volumes:
- /home/runner/ansible-vault:/tmp:ro
- /home/runner/.ssh:/root/.ssh:ro
steps:
- name: Checkout
uses: actions/checkout@v4

- name: Prepare environments (ansible-galaxy install role)
run: |
ansible-galaxy role install -r requirements.yml --ignore-errors
- name: Prepare environments (ansible-galaxy install collection)
run: |
ansible-galaxy collection install -r requirements.yml --ignore-errors
- name: Restore Caches
uses: actions/cache/restore@v4
with:
path: |
/github/home/.cache/
/github/home/.ansible/
key: cache-ansible-roles

- name: "Run ansible-playbook"
env:
Expand Down

0 comments on commit 7aba6de

Please sign in to comment.