imt-re6stnet.yml 1.18 KB
- name: a play that runs entirely on the ansible host
  hosts: 127.0.0.1
  connection: local

  vars_files:
    - settings/imt.yml

  vars_prompt:
    - name: "re6sttoken"
      prompt: "If you have re6st token if you have (ignore if you already have a configured re6st running):"
      private: no 
      default: "notoken"

    - name: "computer_name"
      prompt: "What is this computer name?  (ignore if you already have a configured re6st running):"
      private: no
      default: "noname"

    - name: "lan_iface_name"
      prompt: "What is the interface used by re6st:"
      private: no
      default: "noname"

  post_tasks:

    - name: Add default
      lineinfile: dest=/etc/re6stnet/re6stnet.conf line="default"

    - name: Max Clients
      lineinfile: dest=/etc/re6stnet/re6stnet.conf line="max-clients 1"

    - name: Client count 
      lineinfile: dest=/etc/re6stnet/re6stnet.conf line="client-count 0"

    - name: Include interface
      lineinfile: dest=/etc/re6stnet/re6stnet.conf line="interface {{ lan_iface_name }}"
      when: interface_name != "noname"

    - name: restart re6stnet service
      service: name=re6stnet state=restarted enabled=yes

  roles:
    - re6stnet