Created
October 4, 2020 08:45
-
-
Save lostsnow/64d083b12944d92f052be95730633a3f to your computer and use it in GitHub Desktop.
Ansible mkdir playbook
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
--- | |
- name: mkdir | |
hosts: node_exporters | |
tasks: | |
- name: set ubuntu user name | |
set_fact: sys_user=ubuntu | |
when: ansible_distribution == 'Ubuntu' | |
- name: set centos user name | |
set_fact: sys_user=centos | |
when: ansible_distribution == 'CentOS' | |
- name: Creates directory | |
file: | |
path: "/home/{{ sys_user }}/release" | |
state: directory | |
owner: "{{ sys_user }}" | |
group: "{{ sys_user }}" | |
mode: 0755 | |
recurse: yes |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment