瀏覽代碼

Use new style of calling apt in ansible

Thomas Buck 5 年之前
父節點
當前提交
c71c6d8559
共有 3 個文件被更改,包括 15 次插入6 次删除
  1. 5
    2
      roles/common/tasks/main.yml
  2. 5
    2
      roles/common/tasks/postgres.yml
  3. 5
    2
      roles/common/tasks/security.yml

+ 5
- 2
roles/common/tasks/main.yml 查看文件

@@ -10,8 +10,11 @@
10 10
     - dependencies
11 11
 
12 12
 - name: Install necessities and nice-to-haves
13
-  apt: pkg={{ item }} state=present
14
-  with_items:
13
+  apt:
14
+    name: "{{ packages }}"
15
+    state: present
16
+  vars:
17
+    packages:
15 18
     - apache2
16 19
     - apt-transport-https
17 20
     - apticron

+ 5
- 2
roles/common/tasks/postgres.yml 查看文件

@@ -2,8 +2,11 @@
2 2
 # Defines tasks applicable for postgreSQL
3 3
 
4 4
 - name: Install Postgres
5
-  apt: pkg={{ item }} state=present
6
-  with_items:
5
+  apt:
6
+    name: "{{ packages }}"
7
+    state: present
8
+  vars:
9
+    packages:
7 10
     - postgresql
8 11
     - python-psycopg2
9 12
   tags:

+ 5
- 2
roles/common/tasks/security.yml 查看文件

@@ -1,6 +1,9 @@
1 1
 - name: Install security-related packages
2
-  apt: pkg={{ item }} state=present
3
-  with_items:
2
+  apt:
3
+    name: "{{ packages }}"
4
+    state: present
5
+  vars:
6
+    packages:
4 7
     - fail2ban
5 8
     - whois
6 9
     - lynis

Loading…
取消
儲存