Skip to content

Instantly share code, notes, and snippets.

@lostsnow
Created October 4, 2020 08:45
Show Gist options
  • Save lostsnow/64d083b12944d92f052be95730633a3f to your computer and use it in GitHub Desktop.
Save lostsnow/64d083b12944d92f052be95730633a3f to your computer and use it in GitHub Desktop.
Ansible mkdir playbook
---
- 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