Files
AnsibleTest/A000002.yml
T
CHIEFSOFT\ameye 88f37ec2cd mkdir
2025-07-17 20:18:53 -04:00

42 lines
1.5 KiB
YAML

---
- hosts: "{{ WHAT_HOST_IN_USE }}"
tasks:
- name: "002 Creates directory {{ DESTINATION_FOLDER }}"
ansible.builtin.file:
path: "{{ DESTINATION_FOLDER }}"
state: directory
mode: 0775
recurse: yes
- name: Local Dicrectory for Docker Compose File
ansible.builtin.file:
# path: /home/chiefsoft/semaphore/parts/{{ANSIBLE_TRANSPORT_PATH}}
path: parts/{{ANSIBLE_TRANSPORT_PATH}}
state: directory
register: local_dir
delegate_to: localhost
- name: Retry Local Dicrectory for Docker Compose File
shell: mkdir parts/{{ANSIBLE_TRANSPORT_PATH}}
# # - name: Copy file from 10.10.10.13 to Local Directory
# # shell: scp ~/.ssh/id_rsa.pub {{WHAT_PART_REMOTE}}/docker-compose.yml /home/semaphore/{{ANSIBLE_TRANSPORT_PATH}}/docker-compose.yml
# - name:
# shell: mkdir /home/chiefsoft/semaphore/parts/{{ANSIBLE_TRANSPORT_PATH}}
- name: Copy file from 10.10.10.13 to Local Directory
shell: sshpass -p '{{ password_variable }}' scp {{WHAT_PART_REMOTE}}/docker-compose.yml parts/{{ANSIBLE_TRANSPORT_PATH}}/docker-compose.yml
vars:
password_variable: "May12002!x" # Or, preferably, use Ansible Vault
- name: Set up docker-compose file
template:
src: "/home/chiefsoft/semaphore/parts/{{ANSIBLE_TRANSPORT_PATH}}/docker-compose.yml"
dest: "{{DESTINATION_FOLDER}}"
- name: docker compose up
shell:
chdir: "{{DESTINATION_FOLDER}}/"
cmd: docker-compose up -d