mrlesmithjr / ansible-consul

Ansible role to install/configure Consul
MIT License
8 stars 5 forks source link

Fix systemd service creation for Ubuntu 16.04 #1

Closed mrlesmithjr closed 7 years ago

mrlesmithjr commented 7 years ago

Need to fix systemd service creation for Ubuntu 16.04. The current task sets up the service without systemd.

mrlesmithjr commented 7 years ago

update tasks\config_consul.yml with the following:

- name: config_consul | configuring consul init service (Ubuntu)
  template:
    src: "etc/init/consul.conf.j2"
    dest: "/etc/init/consul.conf"
    owner: root
    group: root
    mode: 0644
  notify: restart consul
  when: >
        (ansible_distribution == "Ubuntu" and
        ansible_distribution_version <= '14.04') and
        (inventory_hostname in groups[consul_clients_group] or
        inventory_hostname in groups[consul_servers_group])

- name: config_consul | configuring consul systemd service
  template:
    src: "etc/systemd/system/consul.service.j2"
    dest: "/etc/systemd/system/consul.service"
    owner: root
    group: root
    mode: 0644
  notify: restart consul
  when: >
        (ansible_distribution == "Debian" or
        (ansible_distribution == "Ubuntu" and
        ansible_distribution_version >= '16.04') or
        ansible_os_family == "RedHat") and
        (inventory_hostname in groups[consul_clients_group] or
        inventory_hostname in groups[consul_servers_group])