aboutsummaryrefslogtreecommitdiffstats
path: root/patches/opnfv-fuel/0012-Add-opnfv-user-to-the-deployment.patch
blob: a1593c955e51448f7b00a8d5127dc7c46ead819a (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
: Copyright (c) 2017 Enea AB and others.
:
: All rights reserved. This program and the accompanying materials
: are made available under the terms of the Apache License, Version 2.0
: which accompanies this distribution, and is available at
: http://www.apache.org/licenses/LICENSE-2.0
::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
From: Charalampos Kominos <Charalampos.Kominos@enea.com>
Date: Fri, 1 Sep 2017 12:24:35 +0200
Subject: [PATCH] Add opnfv user to the deployment

Signed-off-by: Alexandru Avadanii <Alexandru.Avadanii@enea.com>
Signed-off-by: Charalampos Kominos <Charalampos.Kominos@enea.com>
Signed-off-by: Guillermo Herrero <Guillermo.Herrero@enea.com>
---
 mcp/config/states/baremetal_init                         | 1 +
 mcp/config/states/virtual_control_plane                  | 1 +
 mcp/reclass/classes/cluster/all-mcp-arch-common/init.yml | 4 ++++
 mcp/salt-formulas/opnfv/adduser.sls                      | 7 +++++++
 4 files changed, 13 insertions(+)
 create mode 100644 mcp/salt-formulas/opnfv/adduser.sls

diff --git a/mcp/config/states/baremetal_init b/mcp/config/states/baremetal_init
index 771182c..82f783d 100755
--- a/mcp/config/states/baremetal_init
+++ b/mcp/config/states/baremetal_init
@@ -23,6 +23,7 @@ salt -C 'kvm* or cmp*' file.replace $debian_ip_source \
   repl="\n        if not __salt__['pkg.version']('vlan'):\n            __salt__['pkg.install']('vlan')"

 salt -C 'kvm*' pkg.install bridge-utils
+salt -C 'kvm* or cmp*' state.apply opnfv.adduser
 salt -C 'kvm*' state.apply linux.network
 salt -C 'kvm* or cmp*' state.apply salt.minion
 salt -C 'kvm* or cmp*' service.force_reload salt-minion
diff --git a/mcp/config/states/virtual_control_plane b/mcp/config/states/virtual_control_plane
index ab026ef..4212b8e 100755
--- a/mcp/config/states/virtual_control_plane
+++ b/mcp/config/states/virtual_control_plane
@@ -49,6 +49,7 @@ while [ $rc -ne 0 ] && [ ${attempt} -lt ${total_attempts} ]; do
   ((attempt+=1))
 done

+wait_for 5.0 "salt -C 'E@^(?!cfg01|mas01|kvm|cmp00).*' state.apply opnfv.adduser"
 wait_for 10.0 "salt -C '* and not cfg01* and not mas01*' saltutil.sync_all"

 # Propagate APT proxy config created by curtin on baremetal nodes to VCP VMs
diff --git a/mcp/reclass/classes/cluster/all-mcp-arch-common/init.yml b/mcp/reclass/classes/cluster/all-mcp-arch-common/init.yml
index f09ee5d..39d550a 100644
--- a/mcp/reclass/classes/cluster/all-mcp-arch-common/init.yml
+++ b/mcp/reclass/classes/cluster/all-mcp-arch-common/init.yml
@@ -9,3 +9,7 @@
 classes:
   - cluster.all-mcp-arch-common.arch
   - cluster.all-mcp-arch-common.opnfv
+parameters:
+  _param:
+    opnfv_user_username: opnfv
+    opnfv_user_password: $1$5/pIEHT1$XFBhNWW4Q8gYd19hczgPF1
diff --git a/mcp/salt-formulas/opnfv/adduser.sls b/mcp/salt-formulas/opnfv/adduser.sls
new file mode 100644
index 0000000..78ef993
--- /dev/null
+++ b/mcp/salt-formulas/opnfv/adduser.sls
@@ -0,0 +1,7 @@
+add_opnfv_user:
+  user.present:
+  - name: {{ salt['pillar.get']('_param:opnfv_user_username') }}
+  - password: {{ salt['pillar.get']('_param:opnfv_user_password') }}
+  - createhome: True
+  - groups:
+    - sudo