Playbooks to a new Lilik
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

39 lines
1.1 KiB

9 years ago
  1. ---
  2. - block:
  3. - name: install {{ service_name }}
  4. apt:
  5. pkg: "{{ service_packages }}"
  6. state: present
  7. update_cache: yes
  8. cache_valid_time: 3600
  9. install_recommends: '{{ install_recommends | default("no") }}'
  10. - name: start {{ service_name }} at boot
  11. service:
  12. name: "{{ service_name }}"
  13. enabled: yes
  14. when: ansible_distribution != 'openwrt'
  15. - block:
  16. - name: install {{ service_name }}
  17. opkg:
  18. name: "{{ item }}"
  19. state: present
  20. with_items: "{{ service_packages }}"
  21. # remove this in ansible 2.3 (see next comment)
  22. - name: link /etc/init.d/sshd init script to /etc/init.d/ssh
  23. file:
  24. src: "/etc/init.d/sshd"
  25. dest: "/etc/init.d/ssh"
  26. state: link
  27. when: service_name == 'ssh'
  28. # waithing for ansible 2.3 (https://docs.ansible.com/ansible/openwrt_init_module.html)
  29. # - openwrt_init:
  30. # name: "{{ service_name }}"
  31. # enabled: yes
  32. - name: start {{ service_name }} at boot
  33. shell: "/etc/init.d/{{ service_name }} enable"
  34. changed_when: false
  35. when: ansible_distribution == 'openwrt'