From 367579233604aea0001d2647281a13d8f77e4fe1 Mon Sep 17 00:00:00 2001 From: Silvija Tovernic Date: Fri, 20 Sep 2024 20:09:19 +0200 Subject: [PATCH] test ansible --- .github/workflows/ansible-configure-if-vm.yml | 102 ++++++++++-------- 1 file changed, 55 insertions(+), 47 deletions(-) diff --git a/.github/workflows/ansible-configure-if-vm.yml b/.github/workflows/ansible-configure-if-vm.yml index 8beeaee5..ffa25940 100644 --- a/.github/workflows/ansible-configure-if-vm.yml +++ b/.github/workflows/ansible-configure-if-vm.yml @@ -38,6 +38,60 @@ jobs: template: ansible/templates/ansible_ssh_key.j2 output_file: ansible/ansible_ssh_key + + # - name: Configure VM with ansible + # run: | + # cd ansible + # chmod 600 ansible_ssh_key + # mkdir /home/runner/.ssh + # eval "$(ssh-agent -s)" + # cat < /home/runner/.ssh/known_hosts + # 13.81.1.208 ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAIBcvCPBWhalKprTreWRp2+mwtCB9xpqSdGqXg5FNmEGO + # 13.81.1.208 ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAABgQCoJ5mB0Q+kFwqBLISxzrbQP0LiBWzqlRbs7zGNVlwYMkaHn2wcDPNV7BE0h0SizEJ7Md0wDHfHDhVRNL4mHvJCTDeVZGYpEHchMxC/7oWp402xybH70ppON6h/BYAbB8aq8zdXFBLrFkUR9wWhys0ugYxZGXp1kuhLazs2ddZRE4i8em58gzpVgm4UgyKPnmtXJUt35NeiboQjEdzm9AEaQ/xHgT28EdOL4MXGDrxs8DKCIR4y2lO6m5Aregl55TBC8wGMkn5qB+FCrD3UeSDH+rkMNCz6kXT8s5ZMgl1+qzr0ivHKIXEEzR5d8l6il5p3b5tF0VGJp2YwQno/68DGBPHtnW63bvu3Hxisle8RHSFSr0G81AIHz8a2p1+u67EUQH6lTslcGJIztaY6AARKjn/wqTMLSNpwHb60/bE0sGLmz+0U+gSrJcDNpC2rBl6S5poEU9btpN5kCOt7xu/HebxlkgRXUfPTxzwrjNszEFdTABvZKHy9vY2bV/hI+9k= + # 13.81.1.208 ecdsa-sha2-nistp256 AAAAE2VjZHNhLXNoYTItbmlzdHAyNTYAAAAIbmlzdHAyNTYAAABBBOckkT18AWgOEz2TRwL4Swmu50JDxcakkZuKp0Hmdh+g7yJw8gIBpQI/lkSCmz3bVWnPxOZvlC01Qpvs7S1LnYs= + # 10.0.2.6 ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAIFotDXiaILW5kLdjSdnoQO3zdrJd4ClYkxbSEYCMVWvS + # EOF + # ssh-add ansible_ssh_key + # ssh-add -l + # ssh -i ansible_ssh_key -vvv -o ForwardAgent=yes -o ProxyJump=azureadmin@13.81.1.208 -o StrictHostKeyChecking=no azureadmin@10.0.2.6 'hostname' + + + - name: Configure VM with ansible + run: | + cd ansible + ssh -V + eval "$(ssh-agent -s)" + chmod 600 ansible_ssh_key + ssh-add ansible_ssh_key + ssh-add -l + ssh -i ansible_ssh_key -vvv -o ForwardAgent=yes -o ProxyJump=azureadmin@13.81.1.208 -o StrictHostKeyChecking=no azureadmin@10.0.2.6 'hostname' + + + - name: Template Ansible vars file + uses: cuchi/jinja2-action@v1.2.2 + with: + template: ansible/templates/group_vars_all.yml.j2 + output_file: ansible/group_vars/all.yml + + - name: Template Ansible inventory + uses: cuchi/jinja2-action@v1.2.2 + with: + template: ansible/templates/inventory.ini.j2 + output_file: ansible/inventory.ini + + - name: Template Ansible private key file + uses: cuchi/jinja2-action@v1.2.2 + with: + template: ansible/templates/ansible_ssh_key.j2 + output_file: ansible/ansible_ssh_key + + - name: Install Ansible + run: | + pip3 install ansible + + - name: Print Ansible Version + run: ansible-playbook --version + - name: Configure VM with ansible run: | cd ansible @@ -52,52 +106,6 @@ jobs: EOF ssh-add ansible_ssh_key ssh-add -l - ssh -i ansible_ssh_key -vvv -o ForwardAgent=yes -o ProxyJump=azureadmin@13.81.1.208 -o StrictHostKeyChecking=no azureadmin@10.0.2.6 'hostname' - - - # - name: Configure VM with ansible - # run: | - # cd ansible - # ssh -V - # eval "$(ssh-agent -s)" - # chmod 600 ansible_ssh_key - # ssh-add ansible_ssh_key - # ssh-add -l - # ssh -i ansible_ssh_key -vvv -o ForwardAgent=yes -o ProxyJump=azureadmin@13.81.1.208 -o StrictHostKeyChecking=no azureadmin@10.0.2.6 'hostname' - - - # - name: Template Ansible vars file - # uses: cuchi/jinja2-action@v1.2.2 - # with: - # template: ansible/templates/group_vars_all.yml.j2 - # output_file: ansible/group_vars/all.yml - - # - name: Template Ansible inventory - # uses: cuchi/jinja2-action@v1.2.2 - # with: - # template: ansible/templates/inventory.ini.j2 - # output_file: ansible/inventory.ini - - # - name: Template Ansible private key file - # uses: cuchi/jinja2-action@v1.2.2 - # with: - # template: ansible/templates/ansible_ssh_key.j2 - # output_file: ansible/ansible_ssh_key - - # - name: Install Ansible - # run: | - # pip3 install ansible - - # - name: Print Ansible Version - # run: ansible-playbook --version - - # - name: Configure VM with ansible - # run: | - # cd ansible - # eval "$(ssh-agent -s)" - # chmod 600 ansible_ssh_key - # ssh-add ansible_ssh_key - # cat inventory.ini - # ansible-playbook -vvv configure-image-factory-vm.yml + ansible-playbook -vvv configure-image-factory-vm.yml # Test comment to trigger build #