main.yml 2.01 KB
Newer Older
1
---
2 3 4 5 6 7
  - name: Check if configuration exists already
    stat: path=/etc/re6stnet/re6stnet.conf
    register: re6stnet_conf

  - name: Configure Re6st with re6st-conf
    shell: "re6st-conf --registry {{ re6st_registry_url }} --token {{ re6sttoken }} -r title {{ computer_name }}  -d /etc/re6stnet"
8 9 10 11 12 13 14 15 16
    when: re6st_annon == False and re6stnet_conf.stat.exists == False and "{{ re6sttoken }}" != "notoken" and "{{ computer_name }}" != "noname"

  - name: Configure Re6st with re6st-conf
    shell: "re6st-conf --registry {{ re6st_registry_url }} --token {{ re6sttoken }} -r title {{ re6sttoken }}  -d /etc/re6stnet"
    when: re6st_annon == False and re6stnet_conf.stat.exists == False and "{{ re6sttoken }}" != "notoken" and "{{ computer_name }}" == "noname"

  - name: Configure Re6st with re6st-conf
    shell: "re6st-conf --registry {{ re6st_registry_url }} -r title {{ computer_name }}  -d /etc/re6stnet --anonymous"
    when: re6st_annon == True and re6stnet_conf.stat.exists == False and "{{ computer_name }}" != "noname"
17

18 19 20 21
  - name: Check if configuration exists already
    stat: path=/etc/re6stnet/re6stnet.conf
    register: recheck_re6stnet_conf

22 23 24 25 26 27 28 29 30
  - name: stat re6stnet.service
    stat: path=/etc/systemd/re6stnet.service
    register: re6stnet
  
  - name: stat re6st-node.service
    stat: path=/etc/systemd/system/re6st-node.service
    register: re6stnode
  
  - name: set re6st-node.service file
31
    copy: src=/etc/systemd/re6stnet.service dest=/etc/systemd/system/re6stnet.service
32 33
    when: ansible_distribution == 'CentOS' and ansible_distribution_version >= '7' and re6stnet.stat.exists == True and re6stnode.stat.exists == False

34 35 36 37
  - include: daemon.yml
    
  - name: Create centos 6 init.d missing file
    copy: src=files/centos_6_init_d dest=/etc/init.d/re6stnet
38
    when: ansible_distribution == 'CentOS' and ansible_distribution_major_version == '6' and recheck_re6stnet_conf.stat.exists == True
39

40
  - name: Start re6st-node service
41
    service: name=re6stnet state=started enabled=yes
42
    when: recheck_re6stnet_conf.stat.exists == True