From e102b2718ec2106021a4a40c7634fead2fed1fd8 Mon Sep 17 00:00:00 2001 From: Michael Bear <38406045+mjbear@users.noreply.github.com> Date: Sun, 18 Aug 2024 10:25:59 -0400 Subject: [PATCH 1/2] update LABPASSPHRASE variable export to use awk for the entire expression --- .../files/apps/coder/labfiles/avd_l3_dc/README.md | 2 +- .../files/apps/coder/labfiles/lab4/lab4-advanced-playbook.yml | 4 ++-- .../labguides/source/ansible_adhoc_and_simple_playbooks.rst | 2 +- .../files/apps/coder/labfiles/lab4/lab4-advanced-playbook.yml | 2 +- 4 files changed, 5 insertions(+), 5 deletions(-) diff --git a/topologies/dual-datacenter/files/apps/coder/labfiles/avd_l3_dc/README.md b/topologies/dual-datacenter/files/apps/coder/labfiles/avd_l3_dc/README.md index bbfee08d..94823594 100644 --- a/topologies/dual-datacenter/files/apps/coder/labfiles/avd_l3_dc/README.md +++ b/topologies/dual-datacenter/files/apps/coder/labfiles/avd_l3_dc/README.md @@ -98,7 +98,7 @@ git clone https://github.com/PacketAnglers/atd-avd-evpn-vxlan.git Each lab comes with a unique password. We set an environment variable called `LABPASSPHRASE` with the following command. The variable is later used to generate local user passwords and connect to our switches to push configs. ``` bash -export LABPASSPHRASE=`cat /home/coder/.config/code-server/config.yaml| grep "password:" | awk '{print $2}'` +export LABPASSPHRASE=`awk '/password:/{print $2}' /home/coder/.config/code-server/config.yaml` ``` You can view the password is set. This is the same password displayed when you click the link to access your lab. diff --git a/topologies/dual-datacenter/files/apps/coder/labfiles/lab4/lab4-advanced-playbook.yml b/topologies/dual-datacenter/files/apps/coder/labfiles/lab4/lab4-advanced-playbook.yml index 5dc460ae..401d37ff 100644 --- a/topologies/dual-datacenter/files/apps/coder/labfiles/lab4/lab4-advanced-playbook.yml +++ b/topologies/dual-datacenter/files/apps/coder/labfiles/lab4/lab4-advanced-playbook.yml @@ -5,7 +5,7 @@ vars: ansible_user: arista # make sure that LABPASSPHRASE is defined: - # export LABPASSPHRASE=`cat /home/coder/.config/code-server/config.yaml| grep "password:" | awk '{print $2}'` + # export LABPASSPHRASE=`awk '/password:/{print $2}' /home/coder/.config/code-server/config.yaml` ansible_password: "{{ lookup('env', 'LABPASSPHRASE') }}" ansible_network_os: arista.eos.eos ansible_connection: httpapi @@ -16,4 +16,4 @@ - eos_config: lines: - name foo - parents: vlan 500 \ No newline at end of file + parents: vlan 500 diff --git a/topologies/dual-datacenter/labguides/source/ansible_adhoc_and_simple_playbooks.rst b/topologies/dual-datacenter/labguides/source/ansible_adhoc_and_simple_playbooks.rst index b92e2cab..21371593 100644 --- a/topologies/dual-datacenter/labguides/source/ansible_adhoc_and_simple_playbooks.rst +++ b/topologies/dual-datacenter/labguides/source/ansible_adhoc_and_simple_playbooks.rst @@ -179,7 +179,7 @@ following and hit **Enter**: .. code-block:: html - export LABPASSPHRASE=`cat /home/coder/.config/code-server/config.yaml| grep "password:" | awk '{print $2}'` + export LABPASSPHRASE=`awk '/password:/{print $2}' /home/coder/.config/code-server/config.yaml` echo $LABPASSPHRASE ansible-playbook -i labfiles/lab4/lab4-advanced-hosts labfiles/lab4/lab4-advanced-playbook.yml diff --git a/topologies/wan/files/apps/coder/labfiles/lab4/lab4-advanced-playbook.yml b/topologies/wan/files/apps/coder/labfiles/lab4/lab4-advanced-playbook.yml index 7c99c2ad..401d37ff 100644 --- a/topologies/wan/files/apps/coder/labfiles/lab4/lab4-advanced-playbook.yml +++ b/topologies/wan/files/apps/coder/labfiles/lab4/lab4-advanced-playbook.yml @@ -5,7 +5,7 @@ vars: ansible_user: arista # make sure that LABPASSPHRASE is defined: - # export LABPASSPHRASE=`cat /home/coder/.config/code-server/config.yaml| grep "password:" | awk '{print $2}'` + # export LABPASSPHRASE=`awk '/password:/{print $2}' /home/coder/.config/code-server/config.yaml` ansible_password: "{{ lookup('env', 'LABPASSPHRASE') }}" ansible_network_os: arista.eos.eos ansible_connection: httpapi From fe69a8450e6cb19069a01af33cd6a1dc4367925e Mon Sep 17 00:00:00 2001 From: Michael Bear <38406045+mjbear@users.noreply.github.com> Date: Sun, 18 Aug 2024 10:33:07 -0400 Subject: [PATCH 2/2] update the eosStartup.sh veth expression more concise with awk --- nested-labvm/services/eosStartup/eosStartup.sh | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/nested-labvm/services/eosStartup/eosStartup.sh b/nested-labvm/services/eosStartup/eosStartup.sh index bee3f939..023e02de 100644 --- a/nested-labvm/services/eosStartup/eosStartup.sh +++ b/nested-labvm/services/eosStartup/eosStartup.sh @@ -98,7 +98,7 @@ then # Adding below section to adjust veth pair MTUs to 10000 # =============================================== sleep 5 - for i in $(ifconfig | grep veth | awk '{print $1}') + for i in $(ifconfig | awk '/veth/{print $1}') do echo $i ip link set $i mtu 10000 @@ -123,4 +123,4 @@ then else bash /etc/atd/.vtep.sh fi -fi \ No newline at end of file +fi