Posts

Showing posts from January, 2024

Ansible

image: ansible/ansible:latest stages:   - build   - deploy variables:   GIT_STRATEGY: fetch before_script:   - 'which ssh-agent || ( apt-get update -y && apt-get install openssh-client -y )'   - eval $(ssh-agent -s)   - ssh-add <(echo "$SSH_PRIVATE_KEY")   - mkdir -p ~/.ssh   - '[[ -f /.dockerenv ]] && echo -e "Host *\n\tStrictHostKeyChecking no\n\n" > ~/.ssh/config' zip_files:   stage: build   script:     - zip -r archive.zip . -x inventory.yml deploy.yml   artifacts:     paths:       - archive.zip   tags:     - caps-prod   only:     - dev   when: manual ansible_deploy:   stage: deploy   script:     - ansible-playbook -i inventory.yml deploy.yml   dependencies:     - zip_files   tags:     - caps-prod   only:     - dev   when: manual ==================== --- - hosts: target_hosts   become: yes   vars:     src_file: ccCompressed23.3.zip     dest_dir: /opt/temp     app_dir: /opt/app/cc     backup_file: "ccCompresed_bkp_{{ ans