Skip to content

Commit 467acc2

Browse files
committed
fix: Adjustments to logic and minor amendments
1 parent 967af0c commit 467acc2

File tree

6 files changed

+25
-51
lines changed

6 files changed

+25
-51
lines changed

.github/workflows/provision.yml

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -65,11 +65,9 @@ jobs:
6565
- name: Set variables for ansible
6666
id: ansible-variables
6767
run: |
68-
JSON_WITH_NEWLINES=$(cat<<EOF
69-
${{ toJSON(env) }}
70-
EOF)
71-
JSON_WITHOUT_NEWLINES=$(echo $JSON_WITH_NEWLINES | jq -R -c .)
72-
echo "EXTRA_VARS=$JSON_WITHOUT_NEWLINES" >> $GITHUB_OUTPUT
68+
echo '${{ toJSON(env) }}' > tmp_vars.json
69+
JSON_WITHOUT_EMPTY=$(jq -c 'with_entries(select(.value | type == "string" and length > 0))' tmp_vars.json | jq -R )
70+
echo "EXTRA_VARS=$JSON_WITHOUT_EMPTY" >> $GITHUB_OUTPUT
7371
env:
7472
encrypted_disk_size: ${{ vars.DISK_SPACE }}
7573
disk_encryption_key: ${{ secrets.ENCRYPTION_KEY }}

infrastructure/environments/setup-environment.ts

Lines changed: 20 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -272,7 +272,7 @@ const githubOtherQuestions = [
272272
value: 'false'
273273
}
274274
],
275-
valueType: 'SECRET' as const,
275+
valueType: 'VARIABLE' as const,
276276
validate: notEmpty,
277277
valueLabel: 'APPROVAL_REQUIRED',
278278
initial: process.env.APPROVAL_REQUIRED,
@@ -1230,23 +1230,6 @@ ALL_QUESTIONS.push(
12301230
),
12311231
scope: 'ENVIRONMENT' as const
12321232
},
1233-
{
1234-
name: 'ENCRYPTION_KEY',
1235-
type: 'SECRET' as const,
1236-
didExist: findExistingValue(
1237-
'ENCRYPTION_KEY',
1238-
'SECRET',
1239-
'ENVIRONMENT',
1240-
existingValues
1241-
),
1242-
value: findExistingOrDefine(
1243-
'ENCRYPTION_KEY',
1244-
'SECRET',
1245-
'ENVIRONMENT',
1246-
generateLongPassword()
1247-
),
1248-
scope: 'ENVIRONMENT' as const
1249-
},
12501233
{
12511234
type: 'VARIABLE' as const,
12521235
name: 'ACTIVATE_USERS',
@@ -1357,6 +1340,25 @@ ALL_QUESTIONS.push(
13571340
}
13581341
]
13591342

1343+
if (enableEncryption){
1344+
applicationServerUpdates.push({
1345+
name: 'ENCRYPTION_KEY',
1346+
type: 'SECRET' as const,
1347+
didExist: findExistingValue(
1348+
'ENCRYPTION_KEY',
1349+
'SECRET',
1350+
'ENVIRONMENT',
1351+
existingValues
1352+
),
1353+
value: findExistingOrDefine(
1354+
'ENCRYPTION_KEY',
1355+
'SECRET',
1356+
'ENVIRONMENT',
1357+
generateLongPassword()
1358+
),
1359+
scope: 'ENVIRONMENT' as const
1360+
})
1361+
}
13601362

13611363
derivedUpdates.push(...applicationServerUpdates)
13621364

infrastructure/environments/templates.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -109,7 +109,7 @@ export function generateInventory(env: string, values: Record<string, any>){
109109
template = template.replace('{{BACKUP_BLOCK}}', backupBlock);
110110

111111
// Generate kube_api_host line
112-
let kubeApiHost = ' kube_api_host: ' + (values['kube_api_host'] || '');
112+
let kubeApiHost = 'kube_api_host: ' + (values['kube_api_host'] || '');
113113
template = template.replace('{{KUBE_API_HOST_BLOCK}}', kubeApiHost);
114114

115115
const updated = replacePlaceholders(template, values);

infrastructure/environments/templates/inventory/single-node.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ all:
55
# - If your server is exposed (not recommeded), use public IP address
66
# - If you would like to run kubectl commands from the remote server, leave this field empty
77
# kube_api_host: ''
8-
{{KUBE_API_HOST_BLOCK}}
8+
{{KUBE_API_HOST_BLOCK}}
99
# Default ansible provision user, keep as is
1010
ansible_user: provision
1111

infrastructure/server-setup/files/sshd_audit_hardening.22.04.conf

Lines changed: 0 additions & 10 deletions
This file was deleted.

infrastructure/server-setup/tasks/all/users.yml

Lines changed: 0 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -251,20 +251,6 @@
251251
marker: '# {mark} ANSIBLE MANAGED BLOCK FOR USER {{ ansible_user }}'
252252
become: yes
253253

254-
255-
# Add restriction configuration to sshd_config
256-
# For Ubuntu 22.04
257-
- name: SSHD Restrict key exchange, cipher, and MAC algorithms (Ubuntu 22.04)
258-
ansible.builtin.copy:
259-
src: ./files/sshd_audit_hardening.22.04.conf
260-
dest: /etc/ssh/sshd_config.d/audit_hardening.conf
261-
owner: root
262-
group: root
263-
mode: '0644'
264-
when:
265-
- ansible_facts['os_family'] == 'Debian'
266-
- ansible_facts['distribution'] == 'Ubuntu'
267-
- ansible_facts['distribution_version'] is version('22.04', '<=')
268254
# For Ubuntu 24.04
269255
- name: SSHD Restrict key exchange, cipher, and MAC algorithms (Ubuntu 24.04)
270256
ansible.builtin.copy:
@@ -309,5 +295,3 @@
309295
state: restarted
310296
when: ssh_status.rc == 0
311297
become: yes
312-
313-

0 commit comments

Comments
 (0)