pb-auth.yml 751 Bytes
Newer Older
1
- hosts: all
Todor Kondic's avatar
Todor Kondic committed
2
  become: True
Todor Kondic's avatar
...    
Todor Kondic committed
3
  become_method: sudo
4
  remote_user: adamsmith
Todor Kondic's avatar
...    
Todor Kondic committed
5
  become_flags: "-i"
Todor Kondic's avatar
Todor Kondic committed
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
  vars_files:
    - vars/users.yml
    - vars/passwords.yml

  tasks:
    - name: Create /etc/custom-vnc
      file:
        path: "/etc/custom-vnc"
        state: directory
        mode: 0711
        
    - name: Get private ip.
      shell: "hostname -I"
      register: hip
      
    - name: Get hostname.
      shell: "hostname"
      register: hname

    - name: Generate keys.
      script:
        chdir: "/etc/custom-vnc"
        cmd: "files/etc/gencert {{ hname.stdout }} {{ hip.stdout }}"
    - name: Get keys.
      fetch:
        flat: yes
        src: "/etc/custom-vnc/vnc.pub.pem"
        dest: "pubkeys/{{ hname.stdout }}.vnc.pub.pem"