From 2474eb7fea76fd3388b38c4515b7c7fd24d8cc0d Mon Sep 17 00:00:00 2001 From: planetceres Date: Sat, 13 Jan 2018 23:14:17 -0800 Subject: [PATCH 1/6] changed salt stack to latest version on ubuntu --- week2/homework/cloud_resources/README.md | 92 ++++++++++++++++++------ 1 file changed, 70 insertions(+), 22 deletions(-) diff --git a/week2/homework/cloud_resources/README.md b/week2/homework/cloud_resources/README.md index 3b6ceb1..6406e15 100644 --- a/week2/homework/cloud_resources/README.md +++ b/week2/homework/cloud_resources/README.md @@ -75,7 +75,7 @@ Salt Cloud is a cloud provisioning program that we’ll use to automate provisio Provision a new VS (you can choose your own datacenter and domain name if you wish; we recommend using a hostname with the ‘saltmaster’ prefix for Salt configuration management convenience). Note that you’re making use of the SSH key you generated earlier: - slcli vs create -d hou02 --os CENTOS_LATEST --cpu 1 --memory 1024 --hostname saltmaster --domain someplace.net --key identifier + slcli virtual create -d hou02 --os UBUNTU_LATEST_64 --cpu 1 --memory 1024 --hostname saltmaster --domain someplace.net --key identifier Use `slcli vs list` to check up on the provisioning VS. Provisioning is finished when you the ‘action’ field in the output has the value ‘-’. @@ -87,15 +87,68 @@ Use `slcli vs list` and `slcli vs credentials ` or the SoftLayer management #### Install Salt programs -While logged into the VS, execute: +While logged into the VS: - pip install --upgrade pip - pip uninstall -y urllib3 - yum install -y gcc python-devel openssl-devel - pip install m2crypto - curl -o /tmp/install_salt.sh -L https://bootstrap.saltstack.com && sh /tmp/install_salt.sh -Z -M git 2015.5 +*Install [pip on ubuntu](https://www.rosehosting.com/blog/how-to-install-pip-on-ubuntu-16-04/)*: + + $ sudo apt-get update && sudo apt-get -y upgrade + +For Python3: + + $ sudo apt-get install python3-pip + +For Python3: + + $ sudo apt-get install python3-pip + +*Install SoftLayer*: + + $ pip install softlayer + + +Copy the `~/.softlayer` file from your local machine to your ubuntu server (or use `slcli config setup` as in Week 1): + + $ vi ~/.softlayer + + [softlayer] + username = + api_key = + endpoint_url = https://api.softlayer.com/xmlrpc/v3.1/ + timeout = 0 + +Check that `slcli` works before you proceed to install salt. Try getting a list of your servers: + + $ slcli virtual list + + +*Install Salt Stack* + +Follow these instructions to install Salt Stack: https://repo.saltstack.com/#ubuntu. Don’t bother with the post-install config because the defaults are fine. + +1. Run the following command to import the SaltStack repository key: + + wget -O - https://repo.saltstack.com/apt/ubuntu/16.04/amd64/latest/SALTSTACK-GPG-KEY.pub | sudo apt-key add - + +2. Save the following file to /etc/apt/sources.list.d/saltstack.list: + + cat > /etc/apt/sources.list.d/saltstack.list + deb http://repo.saltstack.com/apt/ubuntu/16.04/amd64/latest xenial main + +3. Run sudo apt-get update + +4. Install the salt-minion, salt-master, or other Salt components: + + sudo apt-get install salt-master + sudo apt-get install salt-minion + sudo apt-get install salt-ssh + sudo apt-get install salt-syndic + sudo apt-get install salt-cloud + sudo apt-get install salt-api + +5. (Upgrade only) Restart all upgraded services, for example: + + sudo systemctl restart salt-minion - yum install -y python-pip && pip install SoftLayer apache-libcloud #### Configure Salt Cloud @@ -107,24 +160,19 @@ Alternately you can use an editor of your choice (vim, emacs, nano). Write a cloud provider configuration file. Note that you must replace the values in `<>`'s. The value on the `master: …` line should be the public IP address of your VS. - cat > /etc/salt/cloud.providers.d/softlayer.conf + $ vi /etc/salt/cloud.providers.d/softlayer.conf + sl: minion: master: <6.2.6.1> user: apikey: - provider: softlayer - script: bootstrap-salt - script_args: -Z git 2015.5 - delete_sshkeys: True - display_ssh_output: False - wait_for_ip_timeout: 1800 - ssh_connect_timeout: 1200 - wait_for_fun_timeout: 1200 + driver: softlayer + Verify that you’ve properly written the file to disk: - cat /etc/salt/cloud.providers.d/softlayer.conf + $ cat /etc/salt/cloud.providers.d/softlayer.conf sl: minion: @@ -132,10 +180,10 @@ Verify that you’ve properly written the file to disk: Write a cloud profiles configuration file: - cat > /etc/salt/cloud.profiles.d/softlayer.conf - sl_centos7_small: + $ vi /etc/salt/cloud.profiles.d/softlayer.conf + sl_ubuntu_small: provider: sl - image: CENTOS_7_64 + image: UBUNTU_LATEST_64 cpu_number: 1 ram: 1024 disk_size: 25 @@ -148,7 +196,7 @@ Write a cloud profiles configuration file: Execute: - salt-cloud -p sl_centos7_small + salt-cloud -p sl_ubuntu_small You should observe output like this: From f76e13e1f851b764126667419d579c4a86bc7a4d Mon Sep 17 00:00:00 2001 From: planetceres Date: Sat, 13 Jan 2018 23:16:38 -0800 Subject: [PATCH 2/6] add python2 pip install --- week2/homework/cloud_resources/README.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/week2/homework/cloud_resources/README.md b/week2/homework/cloud_resources/README.md index 6406e15..564daaa 100644 --- a/week2/homework/cloud_resources/README.md +++ b/week2/homework/cloud_resources/README.md @@ -97,9 +97,9 @@ For Python3: $ sudo apt-get install python3-pip -For Python3: +For Python2: - $ sudo apt-get install python3-pip + $ sudo apt-get install python-pip *Install SoftLayer*: From 7a9c1bc902cef62af2cc0b735a6885c3345e93e7 Mon Sep 17 00:00:00 2001 From: planetceres Date: Sat, 13 Jan 2018 23:18:58 -0800 Subject: [PATCH 3/6] minor formatting --- week2/homework/cloud_resources/README.md | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/week2/homework/cloud_resources/README.md b/week2/homework/cloud_resources/README.md index 564daaa..a957a98 100644 --- a/week2/homework/cloud_resources/README.md +++ b/week2/homework/cloud_resources/README.md @@ -89,7 +89,7 @@ Use `slcli vs list` and `slcli vs credentials ` or the SoftLayer management While logged into the VS: -*Install [pip on ubuntu](https://www.rosehosting.com/blog/how-to-install-pip-on-ubuntu-16-04/)*: +**Install [pip on ubuntu](https://www.rosehosting.com/blog/how-to-install-pip-on-ubuntu-16-04/)**: $ sudo apt-get update && sudo apt-get -y upgrade @@ -101,7 +101,7 @@ For Python2: $ sudo apt-get install python-pip -*Install SoftLayer*: +**Install SoftLayer**: $ pip install softlayer @@ -121,7 +121,7 @@ Check that `slcli` works before you proceed to install salt. Try getting a list $ slcli virtual list -*Install Salt Stack* +**Install Salt Stack** Follow these instructions to install Salt Stack: https://repo.saltstack.com/#ubuntu. Don’t bother with the post-install config because the defaults are fine. From 184686ed2b38199d92726d58363fada0d2bfd03f Mon Sep 17 00:00:00 2001 From: planetceres Date: Sat, 13 Jan 2018 23:20:41 -0800 Subject: [PATCH 4/6] more formatting --- week2/homework/cloud_resources/README.md | 22 +++++++++++----------- 1 file changed, 11 insertions(+), 11 deletions(-) diff --git a/week2/homework/cloud_resources/README.md b/week2/homework/cloud_resources/README.md index a957a98..3c3be6f 100644 --- a/week2/homework/cloud_resources/README.md +++ b/week2/homework/cloud_resources/README.md @@ -127,27 +127,27 @@ Follow these instructions to install Salt Stack: https://repo.saltstack.com/#ub 1. Run the following command to import the SaltStack repository key: - wget -O - https://repo.saltstack.com/apt/ubuntu/16.04/amd64/latest/SALTSTACK-GPG-KEY.pub | sudo apt-key add - + `wget -O - https://repo.saltstack.com/apt/ubuntu/16.04/amd64/latest/SALTSTACK-GPG-KEY.pub | sudo apt-key add -` 2. Save the following file to /etc/apt/sources.list.d/saltstack.list: - cat > /etc/apt/sources.list.d/saltstack.list - deb http://repo.saltstack.com/apt/ubuntu/16.04/amd64/latest xenial main + `cat > /etc/apt/sources.list.d/saltstack.list` + `deb http://repo.saltstack.com/apt/ubuntu/16.04/amd64/latest xenial main` -3. Run sudo apt-get update +3. Run `sudo apt-get update` 4. Install the salt-minion, salt-master, or other Salt components: - sudo apt-get install salt-master - sudo apt-get install salt-minion - sudo apt-get install salt-ssh - sudo apt-get install salt-syndic - sudo apt-get install salt-cloud - sudo apt-get install salt-api + `sudo apt-get install salt-master` + `sudo apt-get install salt-minion` + `sudo apt-get install salt-ssh` + `sudo apt-get install salt-syndic` + `sudo apt-get install salt-cloud` + `sudo apt-get install salt-api` 5. (Upgrade only) Restart all upgraded services, for example: - sudo systemctl restart salt-minion + `sudo systemctl restart salt-minion` #### Configure Salt Cloud From bfb17a9abda38ba1e0e7f3663569391fbd564cde Mon Sep 17 00:00:00 2001 From: planetceres Date: Sat, 13 Jan 2018 23:21:37 -0800 Subject: [PATCH 5/6] more formatting --- week2/homework/cloud_resources/README.md | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/week2/homework/cloud_resources/README.md b/week2/homework/cloud_resources/README.md index 3c3be6f..4ae2426 100644 --- a/week2/homework/cloud_resources/README.md +++ b/week2/homework/cloud_resources/README.md @@ -132,6 +132,7 @@ Follow these instructions to install Salt Stack: https://repo.saltstack.com/#ub 2. Save the following file to /etc/apt/sources.list.d/saltstack.list: `cat > /etc/apt/sources.list.d/saltstack.list` + `deb http://repo.saltstack.com/apt/ubuntu/16.04/amd64/latest xenial main` 3. Run `sudo apt-get update` @@ -139,10 +140,15 @@ Follow these instructions to install Salt Stack: https://repo.saltstack.com/#ub 4. Install the salt-minion, salt-master, or other Salt components: `sudo apt-get install salt-master` + `sudo apt-get install salt-minion` + `sudo apt-get install salt-ssh` + `sudo apt-get install salt-syndic` + `sudo apt-get install salt-cloud` + `sudo apt-get install salt-api` 5. (Upgrade only) Restart all upgraded services, for example: From d522b64fd534b5c226ff1fc85dc3dbb9eaa13d00 Mon Sep 17 00:00:00 2001 From: daxaurora Date: Mon, 15 Jan 2018 11:50:12 -0800 Subject: [PATCH 6/6] Minor edits to HW2 --- week2/homework/cloud_resources/README.md | 18 ++++++++++++++---- 1 file changed, 14 insertions(+), 4 deletions(-) diff --git a/week2/homework/cloud_resources/README.md b/week2/homework/cloud_resources/README.md index 4ae2426..b5105db 100644 --- a/week2/homework/cloud_resources/README.md +++ b/week2/homework/cloud_resources/README.md @@ -93,6 +93,8 @@ While logged into the VS: $ sudo apt-get update && sudo apt-get -y upgrade +**Install** either Python2 or Python3: + For Python3: $ sudo apt-get install python3-pip @@ -101,6 +103,10 @@ For Python2: $ sudo apt-get install python-pip +You may need to upgrade pip: + + $ pip install --upgrade pip + **Install SoftLayer**: $ pip install softlayer @@ -108,7 +114,7 @@ For Python2: Copy the `~/.softlayer` file from your local machine to your ubuntu server (or use `slcli config setup` as in Week 1): - $ vi ~/.softlayer + $ cat > ~/.softlayer [softlayer] username = @@ -116,6 +122,8 @@ Copy the `~/.softlayer` file from your local machine to your ubuntu server (or u endpoint_url = https://api.softlayer.com/xmlrpc/v3.1/ timeout = 0 +If copying the file (as above using cat), use **CTRL-D** to complete changes to the file and return to the $ prompt. + Check that `slcli` works before you proceed to install salt. Try getting a list of your servers: $ slcli virtual list @@ -132,9 +140,11 @@ Follow these instructions to install Salt Stack: https://repo.saltstack.com/#ub 2. Save the following file to /etc/apt/sources.list.d/saltstack.list: `cat > /etc/apt/sources.list.d/saltstack.list` - + `deb http://repo.saltstack.com/apt/ubuntu/16.04/amd64/latest xenial main` + Use **CTRL-D** to complete changes to the file and return to the $ prompt. + 3. Run `sudo apt-get update` 4. Install the salt-minion, salt-master, or other Salt components: @@ -166,7 +176,7 @@ Alternately you can use an editor of your choice (vim, emacs, nano). Write a cloud provider configuration file. Note that you must replace the values in `<>`'s. The value on the `master: …` line should be the public IP address of your VS. - $ vi /etc/salt/cloud.providers.d/softlayer.conf + $ cat > /etc/salt/cloud.providers.d/softlayer.conf sl: minion: @@ -186,7 +196,7 @@ Verify that you’ve properly written the file to disk: Write a cloud profiles configuration file: - $ vi /etc/salt/cloud.profiles.d/softlayer.conf + $ cat > /etc/salt/cloud.profiles.d/softlayer.conf sl_ubuntu_small: provider: sl image: UBUNTU_LATEST_64