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.

40 lines
1.1 KiB

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