\documentclass[10pt,a4paper]{article} % Packages \usepackage{fancyhdr} % For header and footer \usepackage{multicol} % Allows multicols in tables \usepackage{tabularx} % Intelligent column widths \usepackage{tabulary} % Used in header and footer \usepackage{hhline} % Border under tables \usepackage{graphicx} % For images \usepackage{xcolor} % For hex colours %\usepackage[utf8x]{inputenc} % For unicode character support \usepackage[T1]{fontenc} % Without this we get weird character replacements \usepackage{colortbl} % For coloured tables \usepackage{setspace} % For line height \usepackage{lastpage} % Needed for total page number \usepackage{seqsplit} % Splits long words. %\usepackage{opensans} % Can't make this work so far. Shame. Would be lovely. \usepackage[normalem]{ulem} % For underlining links % Most of the following are not required for the majority % of cheat sheets but are needed for some symbol support. \usepackage{amsmath} % Symbols \usepackage{MnSymbol} % Symbols \usepackage{wasysym} % Symbols %\usepackage[english,german,french,spanish,italian]{babel} % Languages % Document Info \author{Carl (cjbaccus)} \pdfinfo{ /Title (cisco-ansible.pdf) /Creator (Cheatography) /Author (Carl (cjbaccus)) /Subject (Cisco-Ansible Cheat Sheet) } % Lengths and widths \addtolength{\textwidth}{6cm} \addtolength{\textheight}{-1cm} \addtolength{\hoffset}{-3cm} \addtolength{\voffset}{-2cm} \setlength{\tabcolsep}{0.2cm} % Space between columns \setlength{\headsep}{-12pt} % Reduce space between header and content \setlength{\headheight}{85pt} % If less, LaTeX automatically increases it \renewcommand{\footrulewidth}{0pt} % Remove footer line \renewcommand{\headrulewidth}{0pt} % Remove header line \renewcommand{\seqinsert}{\ifmmode\allowbreak\else\-\fi} % Hyphens in seqsplit % This two commands together give roughly % the right line height in the tables \renewcommand{\arraystretch}{1.3} \onehalfspacing % Commands \newcommand{\SetRowColor}[1]{\noalign{\gdef\RowColorName{#1}}\rowcolor{\RowColorName}} % Shortcut for row colour \newcommand{\mymulticolumn}[3]{\multicolumn{#1}{>{\columncolor{\RowColorName}}#2}{#3}} % For coloured multi-cols \newcolumntype{x}[1]{>{\raggedright}p{#1}} % New column types for ragged-right paragraph columns \newcommand{\tn}{\tabularnewline} % Required as custom column type in use % Font and Colours \definecolor{HeadBackground}{HTML}{333333} \definecolor{FootBackground}{HTML}{666666} \definecolor{TextColor}{HTML}{333333} \definecolor{DarkBackground}{HTML}{852C2C} \definecolor{LightBackground}{HTML}{F7F1F1} \renewcommand{\familydefault}{\sfdefault} \color{TextColor} % Header and Footer \pagestyle{fancy} \fancyhead{} % Set header to blank \fancyfoot{} % Set footer to blank \fancyhead[L]{ \noindent \begin{multicols}{3} \begin{tabulary}{5.8cm}{C} \SetRowColor{DarkBackground} \vspace{-7pt} {\parbox{\dimexpr\textwidth-2\fboxsep\relax}{\noindent \hspace*{-6pt}\includegraphics[width=5.8cm]{/web/www.cheatography.com/public/images/cheatography_logo.pdf}} } \end{tabulary} \columnbreak \begin{tabulary}{11cm}{L} \vspace{-2pt}\large{\bf{\textcolor{DarkBackground}{\textrm{Cisco-Ansible Cheat Sheet}}}} \\ \normalsize{by \textcolor{DarkBackground}{Carl (cjbaccus)} via \textcolor{DarkBackground}{\uline{cheatography.com/189058/cs/39432/}}} \end{tabulary} \end{multicols}} \fancyfoot[L]{ \footnotesize \noindent \begin{multicols}{3} \begin{tabulary}{5.8cm}{LL} \SetRowColor{FootBackground} \mymulticolumn{2}{p{5.377cm}}{\bf\textcolor{white}{Cheatographer}} \\ \vspace{-2pt}Carl (cjbaccus) \\ \uline{cheatography.com/cjbaccus} \\ \end{tabulary} \vfill \columnbreak \begin{tabulary}{5.8cm}{L} \SetRowColor{FootBackground} \mymulticolumn{1}{p{5.377cm}}{\bf\textcolor{white}{Cheat Sheet}} \\ \vspace{-2pt}Not Yet Published.\\ Updated 28th July, 2023.\\ Page {\thepage} of \pageref{LastPage}. \end{tabulary} \vfill \columnbreak \begin{tabulary}{5.8cm}{L} \SetRowColor{FootBackground} \mymulticolumn{1}{p{5.377cm}}{\bf\textcolor{white}{Sponsor}} \\ \SetRowColor{white} \vspace{-5pt} %\includegraphics[width=48px,height=48px]{dave.jpeg} Measure your website readability!\\ www.readability-score.com \end{tabulary} \end{multicols}} \begin{document} \raggedright \raggedcolumns % Set font size to small. Switch to any value % from this page to resize cheat sheet text: % www.emerson.emory.edu/services/latex/latex_169.html \footnotesize % Small font. \begin{multicols*}{3} \begin{tabularx}{5.377cm}{X} \SetRowColor{DarkBackground} \mymulticolumn{1}{x{5.377cm}}{\bf\textcolor{white}{Ansible configuration baseline}} \tn % Row 0 \SetRowColor{LightBackground} \mymulticolumn{1}{x{5.377cm}}{\{\{br\}\} Ansible cfg:} \tn % Row Count 1 (+ 1) \hhline{>{\arrayrulecolor{DarkBackground}}-} \SetRowColor{LightBackground} \mymulticolumn{1}{x{5.377cm}}{{[}defaults{]} \newline inventory=./hosts \newline host\_key\_checking=False \newline retry\_files\_enabled=False \newline gathering=explicit} \tn \hhline{>{\arrayrulecolor{DarkBackground}}-} \end{tabularx} \par\addvspace{1.3em} \begin{tabularx}{5.377cm}{X} \SetRowColor{DarkBackground} \mymulticolumn{1}{x{5.377cm}}{\bf\textcolor{white}{ansible-vault}} \tn \SetRowColor{LightBackground} \mymulticolumn{1}{x{5.377cm}}{ansible-vault encrypt group\_vars/all.yml \newline Please enter password: {\bf{{\emph{}}{\bf{}} \newline Please enter password again: }}{\bf{{\emph{}}}} \newline cat /group\_vars/all.yml \newline \newline \$ANSIBLE\_VAULT;1.1;AES256 \newline 38343566356634663036303038333735363735346166323936323861633039386234353737643266 \newline 6436373736333464616436653338386336373765663464340a316437396662353036663932393031 \newline 36383832333137323737323764613166306364623034633533386664373534336337616634336437 \newline 6362393832356337320a313161333830356338386561386665363637353838613565646666373164 \newline 61303661396364393437633636373138653466303539353334303963653232343432653766383835 \newline 63373261663335373834626433386538383734636430623139663638636633366133323766393366 \newline 38303362346264373766303466333431303762383031386265636364636538666563383234376638 \newline 33653239356635326636303431303431376563656631626463346639646639383431626165633562 \newline 31306139316432626338393561396361386330626261373366323930613166643839316536353832 \newline 62356365653439313638333865633738393863646363646336306331623535363739353132353732 \newline 35643032343330313136383431666335366165306335316537373536663839623233616561613034 \newline 66643335663733386533613466303763396132356534326661653666316230336561623436326664 \newline 34316337316164633661643836333038366530353238306633316266653862336532} \tn \hhline{>{\arrayrulecolor{DarkBackground}}-} \SetRowColor{LightBackground} \mymulticolumn{1}{x{5.377cm}}{Once encrypted, you will have to execute the playbook : ansible-playbook backup.yml -{}-ask-vault-pass} \tn \hhline{>{\arrayrulecolor{DarkBackground}}-} \end{tabularx} \par\addvspace{1.3em} \begin{tabularx}{5.377cm}{x{1.84149 cm} x{3.13551 cm} } \SetRowColor{DarkBackground} \mymulticolumn{2}{x{5.377cm}}{\bf\textcolor{white}{hosts file}} \tn % Row 0 \SetRowColor{LightBackground} hosts file & tiered hosts file \tn % Row Count 1 (+ 1) \hhline{>{\arrayrulecolor{DarkBackground}}--} \SetRowColor{LightBackground} \mymulticolumn{2}{x{5.377cm}}{{[}csr{]} \newline csr1k-2 \seqsplit{ansible\_host=192.168.255.38} \newline csr1k-3 \seqsplit{ansible\_host=192.168.255.34}} \tn \hhline{>{\arrayrulecolor{DarkBackground}}--} \end{tabularx} \par\addvspace{1.3em} \begin{tabularx}{5.377cm}{X} \SetRowColor{DarkBackground} \mymulticolumn{1}{x{5.377cm}}{\bf\textcolor{white}{backup playbook}} \tn \SetRowColor{LightBackground} \mymulticolumn{1}{x{5.377cm}}{`-{}-{}-` \newline - hosts: csr \newline tasks: \newline - name: Show version \newline ios\_command: \newline commands: show run \newline register: version \newline - name: print versions \newline copy: \newline content: "\{\{version.stdout{[}0{]}\}\}\textbackslash{}n\textbackslash{}r" \newline dest: \textasciitilde{}/Cisco-ansible-backup/\{\{inventory\_hostname\}\}-cfg.txt} \tn \hhline{>{\arrayrulecolor{DarkBackground}}-} \SetRowColor{LightBackground} \mymulticolumn{1}{x{5.377cm}}{The last section takes the results of 'show run' command and pastes it to the destination folder.} \tn \hhline{>{\arrayrulecolor{DarkBackground}}-} \end{tabularx} \par\addvspace{1.3em} \begin{tabularx}{5.377cm}{X} \SetRowColor{DarkBackground} \mymulticolumn{1}{x{5.377cm}}{\bf\textcolor{white}{all.yml}} \tn \SetRowColor{LightBackground} \mymulticolumn{1}{x{5.377cm}}{-{}-{}- \newline ansible\_user: "cisco" \newline ansible\_ssh\_pass: "cisco" \newline ansible\_network\_os: "ios" \newline ansible\_connection: "network\_cli"} \tn \hhline{>{\arrayrulecolor{DarkBackground}}-} \SetRowColor{LightBackground} \mymulticolumn{1}{x{5.377cm}}{this file would be placed in group\_vars folder in main directory. (see ansible-vault section for encrypting this file for security reasons)} \tn \hhline{>{\arrayrulecolor{DarkBackground}}-} \end{tabularx} \par\addvspace{1.3em} % That's all folks \end{multicols*} \end{document}