ansible recurse chmod

19.08.2020 / 0 comments

— name: Set execute bit file: path: «{{ tmpdir.path }}/chmoded» mode: ‘0755’ recurse: yes  

ansible local playbook

18.08.2020 / 0 comments

В инвентори добавить: [local] localhost ansible_connection=local В плэйбуке можно выделять блоки: when: «inventory_hostname == ‘localhost'»  

unzip ansible

06.08.2020 / 0 comments

Если исходный архив на узле с ансиблом: — name: Extract jenkins.zip archive from tmp_path unarchive: src: «{{ local_tmp_path}}/jenkins.zip» dest: «{{ remote_tmp_path}}/»   Если исходный архив уже на удалённом узле из инвентори — name: Extract jenkins.zip archive from tmp_path unarchive: src: «{{ remote_tmp_path}}/jenkins.zip» dest: «{{ remote_tmp_path}}/» remote_src: yes  

Запуск скрипта ансибл под рутом и с переменными окружения

05.08.2020 / 0 comments

— block: — name: Run a script.sh with arguments shell: cmd: «{{ remote_tmp_path }}/script.sh —arg1 {{ arg1_value}} —arg2 {{ arg2_value}}» become: yes environment: variable_name: «variable_value» another_variable_name: «another_variable_value» register: run_script_result  

copy ansible

04.08.2020 / 0 comments

— name: Copy directory from ansible to host with owner and permissions copy: src: «local_directory1/» dest: «{{ remote_tmp_path}}/» owner: «uip» group: «uip» mode: ‘0644’  

Листинг/просмотр папки ansible

29.07.2020 / 0 comments

— block: — name: ls /tmp debug shell: cmd: «ls -hals /tmp» register: ls_tmp_debug — debug: msg=»{{ ls_tmp_debug.stdout_lines }}»

Создание новой временной папки ansible

28.07.2020 / 0 comments

— block: — name: Create tmpDir tempfile: state: directory register: tmpdir  

Запуск скрипта ансибл

27.07.2020 / 0 comments

— block: — name: Run a script with arguments shell: cmd: «/scripts/path/filename.sh —argument1 {{ argument1value }}» register: script_result — debug: msg=»{{ script_result.stdout_lines }}»