How to create an empty file with Ansible?
- name: ensure file exists copy: content: "" dest: /etc/nologin force: no group: sys owner: root mode: 0555https://stackoverflow.com/questions/28347717/how-to-create-an-empty-file-with-ansible
【Ansible】かゆいところに手が届く12のTips その1
https://qiita.com/Gin/items/653ae4d9a628334cf34b
inventory 変数で boolean "false" は False と書く
switch=False
Not all spellings of boolean "false" in inventory are interpreted as false by Jinja
https://github.com/ansible/ansible/issues/25784
ansible NFS mount
ansible 変数の優先順位
https://qiita.com/gamisan9999/items/5ff5a7851c442fa3954d
つよい(確信)
- extra vars
- タスクのvars
- ブロックのvars
- ロールのvars/includeした変数ファイル
- set_facts
- 処理でregisterした変数
- 処理内vars_filesで指定のファイルで定義された変数
- 処理内vars_promptでプロンプトから渡された変数
- 処理内のvarsで定義された変数
- ファクト(setupで拾ってきた値)
- Playbookで定義されたhost_vars
- Playbookで定義されたgroup_vars
- インベントリで定義されたhost_vars
- インベントリで定義されたgroup_vars
- インベントリで定義された変数
- ロールのデフォルト(/roles/*/defaults/main.yml)
ansible copy remote to remote
https://derpops.bike/2014/12/25/ansible-copying-content-from-one-remote-system-to-another/
ansible ファイル作成
https://www.cyberciti.biz/faq/how-to-create-a-new-simple-complex-config-file-with-ansible-playbook/
ansible check_mode changed_when
- command: test -f /path_to/file check_mode: no changed_when: false register: _test_file - some_module: hogehohe when: _test_file.rc = 1https://dev.classmethod.jp/server-side/ansible/using_check_mode/
https://dev.classmethod.jp/server-side/ansible/ansible_playbook_with_idempotence/
例
- command: wp core is-installed --path=/var/www/html check_mode: no changed_when: false register: _check_wp_installation
wpがインストールされているか判定、checkモードでも実行、changedにしない