You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@cloudstack.apache.org by GitBox <gi...@apache.org> on 2022/04/29 14:14:50 UTC

[GitHub] [cloudstack-documentation] weizhouapache commented on a diff in pull request #215: Modernizing "Create linux template" guide + Cloud-init integration steps

weizhouapache commented on code in PR #215:
URL: https://github.com/apache/cloudstack-documentation/pull/215#discussion_r861843752


##########
source/adminguide/templates/_cloud_init.rst:
##########
@@ -0,0 +1,243 @@
+.. Licensed to the Apache Software Foundation (ASF) under one
+   or more contributor license agreements.  See the NOTICE file
+   distributed with this work for additional information#
+   regarding copyright ownership.  The ASF licenses this file
+   to you under the Apache License, Version 2.0 (the
+   "License"); you may not use this file except in compliance
+   with the License.  You may obtain a copy of the License at
+   http://www.apache.org/licenses/LICENSE-2.0
+   Unless required by applicable law or agreed to in writing,
+   software distributed under the License is distributed on an
+   "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+   KIND, either express or implied.  See the License for the
+   specific language governing permissions and limitations
+   under the License.
+
+
+Cloud-init integration
+-------------------------
+
+Cloudstack and cloud-init integration provide instances with advanced management features such as:
+
+*  Password management
+*  SSH keys management
+*  Partition management
+*  User-data input
+*  `Other modules <https://cloudinit.readthedocs.io/en/latest/topics/modules.html>`_  
+
+
+
+Examples for relevant features are listed for different distributions.
+
+~~~~~~~~~~~~~~~~~~~~~~
+
+Linux with Cloud-init
+----------------------
+
+These features can be implemented in `“Linux template creation process” <_create_linux.html#creating-a-linux-template>`_. where they are executed just before the **Template cleanup** step.
+
+#. **Install and configure cloud-init**
+
+   Install cloud-init and mentioned auxiliary packages.
+
+   ~  CentOS
+   
+    .. code:: bash
+
+	 yum install -y cloud-init wget
+   
+   ~  Ubuntu
+   
+    .. code:: bash
+
+     apt-get install -y cloud-init wget
+	 
+   Configure cloud-init to detect Cloudstack data source during runtime.
+	
+   ~  CentOS
+   
+    CentOS cloud-init looks for datasources in /etc/cloud/ds-indetify.cfg during boot. Add the following config in that file.
+   
+    .. code:: bash
+
+     datasource: CloudStack
+   
+   ~  Ubuntu
+   
+    Ubuntu cloud-init data sources can be specified in /etc/cloud/cloud.cfg.d/ directory. Add the following config in /etc/cloud/cloud.cfg.d/99_cloudstack.cfg.
+   
+    .. code:: bash
+
+     datasource_list: [ ConfigDrive, CloudStack, None ]
+     datasource:
+       CloudStack: {}
+       None: {}
+	   
+#. **Password management**
+
+   Cloudstack integration with cloud-init `set-passwords module <https://cloudinit.readthedocs.io/en/latest/topics/modules.html?highlight=ssh_pwauth#set-passwords>`_ will enable the platform to set a password for each instance created from the Main Template. Additionally it will allow to reset the user password through the GUI.
+   
+   - **Enable set-passwords module on every boot**
+   
+     By default the set-passwords module runs only on first boot of the instance, change that to run on every boot.
+   
+     .. code:: bash
+   
+      sudo sed -i s/" - set-passwords"/" - [set-passwords, always]"/g /etc/cloud/cloud.cfg
+	
+   - **Specify the managed user**
+   
+     Cloudstack will create the user, set a password and reset it when requested. To do that set the following configuration in /etc/cloud/cloud.cfg.d/80_user.cfg
+		
+     .. code:: bash
+
+      system_info:
+        default_user:
+          name: cloud-user	               
+          lock_passwd: false	          # disable user password login - true/false
+          sudo: [\"ALL=(ALL) ALL\"] 	  # User permissions
+      disable_root: 0	                  # root remote login is 0 - enabled, 1 - disabled
+      ssh_pwauth: 1	                      # password login is 0 - disabled, 1- enabled
+
+#. **SSH keys management**
+
+   Cloud-init `ssh module <https://cloudinit.readthedocs.io/en/latest/topics/modules.html#ssh>`_ can automatically install new SSH keys when set or reset from Cloudstack GUI.
+   By default the module runs once during instance creation and will fetch Cloudstack keys without any additional configuration. 
+   To enable Cloudstack reset SSH keys feature configure cloud-init ssh module to run on every boot.
+   
+   .. code:: bash
+   
+    sudo sed -i s/" - ssh$"/" - [ssh, always]"/g /etc/cloud/cloud.cfg
+<<<<<<< Updated upstream

Review Comment:
   ```suggestion
   ```



##########
source/adminguide/templates/_cloud_init.rst:
##########
@@ -0,0 +1,243 @@
+.. Licensed to the Apache Software Foundation (ASF) under one
+   or more contributor license agreements.  See the NOTICE file
+   distributed with this work for additional information#
+   regarding copyright ownership.  The ASF licenses this file
+   to you under the Apache License, Version 2.0 (the
+   "License"); you may not use this file except in compliance
+   with the License.  You may obtain a copy of the License at
+   http://www.apache.org/licenses/LICENSE-2.0
+   Unless required by applicable law or agreed to in writing,
+   software distributed under the License is distributed on an
+   "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+   KIND, either express or implied.  See the License for the
+   specific language governing permissions and limitations
+   under the License.
+
+
+Cloud-init integration
+-------------------------
+
+Cloudstack and cloud-init integration provide instances with advanced management features such as:
+
+*  Password management
+*  SSH keys management
+*  Partition management
+*  User-data input
+*  `Other modules <https://cloudinit.readthedocs.io/en/latest/topics/modules.html>`_  
+
+
+
+Examples for relevant features are listed for different distributions.
+
+~~~~~~~~~~~~~~~~~~~~~~
+
+Linux with Cloud-init
+----------------------
+
+These features can be implemented in `“Linux template creation process” <_create_linux.html#creating-a-linux-template>`_. where they are executed just before the **Template cleanup** step.
+
+#. **Install and configure cloud-init**
+
+   Install cloud-init and mentioned auxiliary packages.
+
+   ~  CentOS
+   
+    .. code:: bash
+
+	 yum install -y cloud-init wget
+   
+   ~  Ubuntu
+   
+    .. code:: bash
+
+     apt-get install -y cloud-init wget
+	 
+   Configure cloud-init to detect Cloudstack data source during runtime.
+	
+   ~  CentOS
+   
+    CentOS cloud-init looks for datasources in /etc/cloud/ds-indetify.cfg during boot. Add the following config in that file.
+   
+    .. code:: bash
+
+     datasource: CloudStack
+   
+   ~  Ubuntu
+   
+    Ubuntu cloud-init data sources can be specified in /etc/cloud/cloud.cfg.d/ directory. Add the following config in /etc/cloud/cloud.cfg.d/99_cloudstack.cfg.
+   
+    .. code:: bash
+
+     datasource_list: [ ConfigDrive, CloudStack, None ]
+     datasource:
+       CloudStack: {}
+       None: {}
+	   
+#. **Password management**
+
+   Cloudstack integration with cloud-init `set-passwords module <https://cloudinit.readthedocs.io/en/latest/topics/modules.html?highlight=ssh_pwauth#set-passwords>`_ will enable the platform to set a password for each instance created from the Main Template. Additionally it will allow to reset the user password through the GUI.
+   
+   - **Enable set-passwords module on every boot**
+   
+     By default the set-passwords module runs only on first boot of the instance, change that to run on every boot.
+   
+     .. code:: bash
+   
+      sudo sed -i s/" - set-passwords"/" - [set-passwords, always]"/g /etc/cloud/cloud.cfg
+	
+   - **Specify the managed user**
+   
+     Cloudstack will create the user, set a password and reset it when requested. To do that set the following configuration in /etc/cloud/cloud.cfg.d/80_user.cfg
+		
+     .. code:: bash
+
+      system_info:
+        default_user:
+          name: cloud-user	               
+          lock_passwd: false	          # disable user password login - true/false
+          sudo: [\"ALL=(ALL) ALL\"] 	  # User permissions
+      disable_root: 0	                  # root remote login is 0 - enabled, 1 - disabled
+      ssh_pwauth: 1	                      # password login is 0 - disabled, 1- enabled
+
+#. **SSH keys management**
+
+   Cloud-init `ssh module <https://cloudinit.readthedocs.io/en/latest/topics/modules.html#ssh>`_ can automatically install new SSH keys when set or reset from Cloudstack GUI.
+   By default the module runs once during instance creation and will fetch Cloudstack keys without any additional configuration. 
+   To enable Cloudstack reset SSH keys feature configure cloud-init ssh module to run on every boot.
+   
+   .. code:: bash
+   
+    sudo sed -i s/" - ssh$"/" - [ssh, always]"/g /etc/cloud/cloud.cfg
+<<<<<<< Updated upstream
+    
+=======
+	
+>>>>>>> Stashed changes

Review Comment:
   ```suggestion
   ```



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: dev-unsubscribe@cloudstack.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org