main.yml 4.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196
  1. # - name: Remove postfix at first
  2. # become: true
  3. # apt:
  4. # name: postfix
  5. # state: absent
  6. # purge: yes
  7. # - name: Backup /etc/apt/sources.list.d
  8. # become: true
  9. # copy:
  10. # src: /etc/apt/sources.list.d
  11. # dest: "{{ app_backup }}/etc_apt_sources_list_d"
  12. # remote_src: yes
  13. # backup: yes
  14. # - name: Delete /etc/apt/sources.list.d
  15. # become: true
  16. # file:
  17. # state: absent
  18. # path: /etc/apt/sources.list.d
  19. - import_tasks: init.yml
  20. # https://github.com/nodesource/distributions#deb
  21. # - name: Download nodejs-ppa installer
  22. # get_url:
  23. # url: https://deb.nodesource.com/setup_lts.x
  24. # dest: "{{ app_downloads }}/setup_node_lts.sh"
  25. # mode: '0755'
  26. # - name: Install nodejs ppa
  27. # become: true
  28. # ansible.builtin.shell: "{{ app_downloads }}/setup_node_lts.sh"
  29. - name: add PPA for Ubuntu Toolchain
  30. become: true
  31. ansible.builtin.apt_repository:
  32. repo: ppa:ubuntu-toolchain-r/test
  33. when: ansible_distribution == 'Ubuntu'
  34. - name: Update system
  35. become: true
  36. apt:
  37. upgrade: yes
  38. update_cache: yes
  39. cache_valid_time: 3600
  40. - name: Install dependicy packages
  41. become: true
  42. apt:
  43. pkg:
  44. - apt-transport-https
  45. - software-properties-common
  46. - gnupg
  47. - openssh-server
  48. - openssh-client
  49. - sshpass
  50. - wpasupplicant
  51. - rsync
  52. - at
  53. - sysstat
  54. - libtool
  55. - ethtool
  56. - dnsutils
  57. - dnsmasq
  58. - uuid-runtime
  59. - lshw
  60. - tcpdump
  61. - lm-sensors
  62. - hddtemp
  63. - dmidecode
  64. - net-tools
  65. - iputils-arping
  66. - iputils-ping
  67. - telnet
  68. - vim
  69. - git
  70. - pwgen
  71. - locales
  72. - ntpdate
  73. - imagemagick
  74. - mpg123
  75. - ffmpeg
  76. - sqlite3
  77. - tree
  78. - alsa-utils
  79. - pulseaudio
  80. - zsh
  81. - wget
  82. - curl
  83. - zip
  84. - unzip
  85. - nginx
  86. - libnginx-mod-http-upstream-fair
  87. - certbot
  88. - python3-certbot-nginx
  89. - openvpn
  90. - snmpd
  91. - mutt
  92. - systemd-cron
  93. - screen
  94. - tmux
  95. - hugo
  96. - nodejs
  97. - python3
  98. - python3-pip
  99. - python3-distutils
  100. - python3-dev
  101. - libssl-dev
  102. - libpq-dev
  103. - libmysqlclient-dev
  104. - name: Install dependicy packages(>bionic)
  105. become: true
  106. apt:
  107. pkg:
  108. - systemd-timesyncd
  109. - yarnpkg
  110. # ansible_facts['distribution'] == "Ubuntu"
  111. when: ansible_facts['distribution_major_version'] | int >= 20
  112. - import_tasks: locales.yml
  113. - name: Set default editor to vim
  114. become: true
  115. shell: update-alternatives --set editor /usr/bin/vim.basic
  116. - name: Set timezone
  117. become: true
  118. shell: timedatectl set-timezone UTC
  119. - name: Set git rebase mode
  120. become: true
  121. shell: git config --global pull.rebase false
  122. - import_tasks: zsh.yml
  123. # ---------------------------------------------------
  124. - name: check if friendlyelec
  125. ansible.builtin.stat:
  126. path: /etc/friendlyelec-release
  127. register: app_os_friendlyelec
  128. - import_tasks: friendly-core.yml
  129. when: app_os_friendlyelec.stat.islnk is defined and app_os_friendlyelec.stat.isreg
  130. - name: check if armbian
  131. ansible.builtin.stat:
  132. path: /etc/armbian-release
  133. register: app_os_armbian
  134. - import_tasks: armbian.yml
  135. when: app_os_armbian.stat.islnk is defined and app_os_armbian.stat.isreg
  136. - import_tasks: raspbian.yml
  137. when: ansible_distribution == 'Raspbian'
  138. - import_tasks: pi.yml
  139. when: ansible_distribution == 'Raspbian' or (app_os_armbian.stat.islnk is defined and app_os_armbian.stat.isreg) or (app_os_friendlyelec.stat.islnk is defined and app_os_friendlyelec.stat.isreg)
  140. # ---------------------------------------------------
  141. - name: enable nginx service
  142. become: true
  143. ansible.builtin.systemd:
  144. name: nginx
  145. enabled: yes
  146. masked: no
  147. - name: enable cron service
  148. become: true
  149. ansible.builtin.systemd:
  150. name: cron
  151. enabled: yes
  152. masked: no
  153. - name: enable ssh service
  154. become: true
  155. ansible.builtin.systemd:
  156. name: ssh
  157. enabled: yes
  158. masked: no
  159. - name: enable systemd-timesyncd service
  160. become: true
  161. ansible.builtin.systemd:
  162. name: systemd-timesyncd
  163. enabled: yes
  164. masked: no
  165. - import_tasks: clean.yml