|
16 | 16 | when: "ansible_facts.os_family == 'Debian'" |
17 | 17 | block: |
18 | 18 | - name: "Remove GitLab APT GPG key from legacy trusted.gpg keyring" |
| 19 | + become: true |
19 | 20 | ansible.builtin.apt_key: |
20 | 21 | url: "{{ gitlab_gpg_key_url }}" |
21 | 22 | id: "{{ gitlab_gpg_key_id }}" |
22 | 23 | state: "absent" |
23 | 24 | when: "not __gitlab_is_initial_dryrun" |
24 | 25 |
|
25 | 26 | - name: "Remove GitLab APT repository from sources.list" |
| 27 | + become: true |
26 | 28 | ansible.builtin.apt_repository: |
27 | 29 | repo: "deb {{ gitlab_repo_url }} {{ ansible_facts.distribution_release }} main" |
28 | 30 | state: "absent" |
29 | 31 | filename: "gitlab_{{ gitlab_edition }}" |
30 | 32 | update_cache: false |
31 | 33 |
|
32 | 34 | - name: "Remove GitLab source APT repository from sources.list" |
| 35 | + become: true |
33 | 36 | ansible.builtin.apt_repository: |
34 | 37 | repo: "deb-src {{ gitlab_repo_url }} {{ ansible_facts.distribution_release }} main" |
35 | 38 | state: "absent" |
36 | 39 | filename: "gitlab_{{ gitlab_edition }}" |
37 | 40 | update_cache: false |
38 | 41 |
|
39 | 42 | - name: "Add GitLab APT repository" |
| 43 | + become: true |
40 | 44 | ansible.builtin.deb822_repository: |
41 | 45 | name: "{{ gitlab_edition }}" |
42 | 46 | types: |
|
52 | 56 | enabled: true |
53 | 57 |
|
54 | 58 | - name: "Update APT package cache" |
| 59 | + become: true |
55 | 60 | ansible.builtin.apt: |
56 | 61 | update_cache: true |
57 | 62 | check_mode: false |
|
61 | 66 | when: "ansible_facts.os_family == 'RedHat'" |
62 | 67 | block: |
63 | 68 | - name: "Add GitLab yum repository" |
| 69 | + become: true |
64 | 70 | ansible.builtin.yum_repository: |
65 | 71 | name: "gitlab_{{ gitlab_edition }}" |
66 | 72 | description: "GitLab yum repo" |
|
78 | 84 | metadata_expire: "300" |
79 | 85 |
|
80 | 86 | - name: "Add GitLab source yum repository" |
| 87 | + become: true |
81 | 88 | ansible.builtin.yum_repository: |
82 | 89 | name: "gitlab_{{ gitlab_edition }}-source" |
83 | 90 | description: "GitLab source yum repo" |
|
95 | 102 | metadata_expire: "300" |
96 | 103 |
|
97 | 104 | - name: "Update yum package cache" |
| 105 | + become: true |
98 | 106 | ansible.builtin.dnf: |
99 | 107 | update_cache: true |
100 | 108 | check_mode: false |
|
112 | 120 | - "__gitlab_rails_binary.stat.executable" |
113 | 121 | block: |
114 | 122 | - name: "Get the currently installed GitLab version" |
| 123 | + become: true |
115 | 124 | ansible.builtin.slurp: |
116 | 125 | path: "/var/opt/gitlab/gitlab-rails/VERSION" |
117 | 126 | register: "__gitlab_version_base64" |
|
147 | 156 | rescue: |
148 | 157 |
|
149 | 158 | - name: "Ensure GitLab directory exists" |
| 159 | + become: true |
150 | 160 | ansible.builtin.file: |
151 | 161 | path: "/etc/gitlab" |
152 | 162 | state: "directory" |
|
155 | 165 | mode: "0775" |
156 | 166 |
|
157 | 167 | - name: "Create file to detect a failed reconfigure" |
| 168 | + become: true |
158 | 169 | ansible.builtin.copy: |
159 | 170 | content: "This file is managed by Ansible." |
160 | 171 | dest: "/etc/gitlab/reconfigure_failed" |
|
0 commit comments