From 51ff06248b4d4e3991742440698e77cca17e4a29 Mon Sep 17 00:00:00 2001 From: Hayato Date: Sun, 20 Oct 2024 04:02:28 +0900 Subject: [PATCH] ansible-play on container --- .github/workflows/develop_branch.yml | 21 +++++++++------ .github/workflows/main_branch.yml | 38 ++++++++++++++++++---------- 2 files changed, 37 insertions(+), 22 deletions(-) diff --git a/.github/workflows/develop_branch.yml b/.github/workflows/develop_branch.yml index 32ba613..db20a04 100644 --- a/.github/workflows/develop_branch.yml +++ b/.github/workflows/develop_branch.yml @@ -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: @@ -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 diff --git a/.github/workflows/main_branch.yml b/.github/workflows/main_branch.yml index 4a28c8b..4f2d6da 100644 --- a/.github/workflows/main_branch.yml +++ b/.github/workflows/main_branch.yml @@ -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: @@ -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: