dma.yml 1.56 KB
  - name: Create Groups
    group:
      gid: "{{ item.gid }}"
      name: "{{ item.name }}"
      state: present
    with_items:
      - { gid: 1010, name: wdview }
      - { gid: 1001, name: wdadmin }
      - { gid: 996,  name: nginx }
      - { gid: 999,  name: wildfly }
      - { gid: 998,  name: postgres }
      - { gid: 995,  name: mosquitto }
      
  - name: Create Users
    user:
      uid: "{{ item.uid }}"
      home: "{{ item.path }}"
      name: "{{ item.name }}"
      group: "{{ item.name }}"
      shell: "{{ item.shell }}"
      system: "{{ item.system }}"
      createhome: "{{ item.crehome }}"
      state: present
    with_items:
      - { uid: 1010, name: wdview,  crehome: yes, system: no,  shell: /bin/bash,         path: /home/wdview }
      - { uid: 1001, name: wdadmin, crehome: yes, system: no,  shell: /bin/bash,         path: /home/wdadmin }
      - { uid: 999,  name: wildfly, crehome: no,  system: yes, shell: /bin/bash,         path: /home/wildfly }
      - { uid: 996,  name: nginx,   crehome: no,  system: yes, shell: /usr/sbin/nologin, path: /home/nginx }
      - { uid: 998,  name: postgres, crehome: no,  system: yes, shell: /bin/bash,         path: /home/postgres }
      - { uid: 995,  name: mosquitto, crehome: no,  system: yes, shell: /bin/bash,         path: /opt/stack/mqtt }
      
  - name: Allow 'wildfly' group to have passwordless sudo
    lineinfile:
            dest: /etc/sudoers
            state: present
            regexp: '^%wildfly'
            line: '%wildfly ALL=(ALL) NOPASSWD: ALL'
            validate: 'visudo -cf %s'