u/fuel: Bump & rebase for Salt 2017.7 bump
[armband.git] / patches / opnfv-fuel / 0004-Add-opnfv-user-to-the-deployment.patch
1 ::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
2 : Copyright (c) 2018 Enea AB and others.
3 :
4 : All rights reserved. This program and the accompanying materials
5 : are made available under the terms of the Apache License, Version 2.0
6 : which accompanies this distribution, and is available at
7 : http://www.apache.org/licenses/LICENSE-2.0
8 ::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
9 From: Charalampos Kominos <Charalampos.Kominos@enea.com>
10 Date: Fri, 1 Sep 2017 12:24:35 +0200
11 Subject: [PATCH] Add opnfv user to the deployment
12
13 Signed-off-by: Alexandru Avadanii <Alexandru.Avadanii@enea.com>
14 Signed-off-by: Charalampos Kominos <Charalampos.Kominos@enea.com>
15 Signed-off-by: Guillermo Herrero <Guillermo.Herrero@enea.com>
16 ---
17  mcp/config/states/baremetal_init                           | 1 +
18  mcp/config/states/virtual_control_plane                    | 1 +
19  .../classes/cluster/all-mcp-arch-common/init.yml.j2        | 3 +++
20  mcp/salt-formulas/opnfv/adduser.sls                        | 7 +++++++
21  4 files changed, 12 insertions(+)
22  create mode 100644 mcp/salt-formulas/opnfv/adduser.sls
23
24 diff --git a/mcp/config/states/baremetal_init b/mcp/config/states/baremetal_init
25 index 14d6a570..1317900a 100755
26 --- a/mcp/config/states/baremetal_init
27 +++ b/mcp/config/states/baremetal_init
28 @@ -27,6 +27,7 @@ salt -C "${cluster_nodes_query}" file.replace $debian_ip_source \
29    repl="\n        if not __salt__['pkg.version']('vlan'):\n            __salt__['pkg.install']('vlan')"
30
31  salt -C "${cluster_nodes_query}" pkg.install bridge-utils
32 +salt -C "${control_nodes_query}" state.apply opnfv.adduser
33  salt -C "${control_nodes_query}" state.apply linux.network,linux.system.kernel
34  wait_for 5.0 "salt -C '${cluster_nodes_query}' state.apply salt.minion"
35  wait_for 5.0 "salt -C '${compute_nodes_query}' state.apply linux.system,linux.network"
36 diff --git a/mcp/config/states/virtual_control_plane b/mcp/config/states/virtual_control_plane
37 index cc227a97..51823a0c 100755
38 --- a/mcp/config/states/virtual_control_plane
39 +++ b/mcp/config/states/virtual_control_plane
40 @@ -39,6 +39,7 @@ vcp_nodes=$(salt --out yaml 'kvm01*' pillar.get salt:control:cluster:internal:no
41  # Check all vcp nodes are available
42  wait_for 25.0 "(for n in ${vcp_nodes}; do salt \${n} test.ping 2>/dev/null || exit; done)"
43
44 +wait_for 5.0 "salt -C 'E@^(?!cfg01|mas01|kvm|cmp00).*' state.apply opnfv.adduser"
45  wait_for 10.0 "salt -C '* and not cfg01* and not mas01*' saltutil.sync_all"
46
47  # Propagate APT proxy config created by curtin on baremetal nodes to VCP VMs
48 diff --git a/mcp/reclass/classes/cluster/all-mcp-arch-common/init.yml.j2 b/mcp/reclass/classes/cluster/all-mcp-arch-common/init.yml.j2
49 index 987c5eb2..afeadc80 100644
50 --- a/mcp/reclass/classes/cluster/all-mcp-arch-common/init.yml.j2
51 +++ b/mcp/reclass/classes/cluster/all-mcp-arch-common/init.yml.j2
52 @@ -11,6 +11,9 @@ classes:
53    - cluster.all-mcp-arch-common.opnfv
54  parameters:
55    _param:
56 +    opnfv_user_username: opnfv
57 +    opnfv_user_password: $1$5/pIEHT1$XFBhNWW4Q8gYd19hczgPF1
58 +
59      salt_control_trusty_image: ''  # Dummy value, to keep reclass 1.5.2 happy
60      salt_control_xenial_image: salt://salt/files/control/images/base_image_opnfv_fuel_vcp.img
61
62 diff --git a/mcp/salt-formulas/opnfv/adduser.sls b/mcp/salt-formulas/opnfv/adduser.sls
63 new file mode 100644
64 index 00000000..78ef993d
65 --- /dev/null
66 +++ b/mcp/salt-formulas/opnfv/adduser.sls
67 @@ -0,0 +1,7 @@
68 +add_opnfv_user:
69 +  user.present:
70 +  - name: {{ salt['pillar.get']('_param:opnfv_user_username') }}
71 +  - password: {{ salt['pillar.get']('_param:opnfv_user_password') }}
72 +  - createhome: True
73 +  - groups:
74 +    - sudo