Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
66 changes: 66 additions & 0 deletions Makefile
Original file line number Diff line number Diff line change
@@ -0,0 +1,66 @@
#Defining variables
MD_FILES := frontmatter.txt \
foreword.txt \
preface.txt \
introduction.txt \
mainmatter.txt \
chapter1.txt \
chapter2.txt \
chapter3.txt \
chapter4.txt \
chapter5.txt \
chapter6.txt \
chapter7.txt \
chapter8.txt \
chapter9.txt \
chapter10.txt \
chapter11.txt \
chapter12.txt \
chapter13.txt \
chapter13A.txt \
chapter13B.txt \
chapter14.txt \
chapter15.txt \
afterword.txt \
backmatter.txt \
appendix-a.txt \
appendix-b.txt

COVER_IMAGE := images/cover_art.jpg
COVER_HEADER := cover_header.tex
COVER_BODY := cover_body.tex
PDF_OUTPUT := ansible-for-devops.pdf
EPUB_OUTPUT := ansible-for-devops.epub
PANDOC := pandoc
PANDOC_FLAGS := --from=markdown \
--toc \
--toc-depth=2 \
--metadata title="Ansible for DevOps" \
--metadata author="Jeff Geerling"
LATEX_FLAGS := --pdf-engine=xelatex \
--include-in-header=$(COVER_HEADER) \
--include-before-body=$(COVER_BODY) \
--template=eisvogel.latex
EPUB_FLAGS := --epub-cover-image=$(COVER_IMAGE) \
# --css=epub.css

# Default target
all: pdf epub

# Generating PDF
pdf: $(PDF_OUTPUT)

$(PDF_OUTPUT): $(MD_FILES)
$(PANDOC) $(PANDOC_FLAGS) $(LATEX_FLAGS) -o $@ $(MD_FILES)

# Generating EPUB
epub: $(EPUB_OUTPUT)

$(EPUB_OUTPUT): $(MD_FILES)
$(PANDOC) $(PANDOC_FLAGS) $(EPUB_FLAGS) -o $@ $(MD_FILES)

# Cleaning up generated files
clean:
rm -f $(PDF_OUTPUT) $(EPUB_OUTPUT)

.PHONY: all pdf epub clean
10 changes: 10 additions & 0 deletions after-header-includes.latex
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
\usepackage{bookmark}
\IfFileExists{xurl.sty}{\usepackage{xurl}}{} % add URL line breaks if available
\urlstyle{$if(urlstyle)$$urlstyle$$else$same$endif$}
$if(links-as-notes)$
% Make links footnotes instead of hotlinks:
\DeclareRobustCommand{\href}[2]{#2\footnote{\url{#1}}}
$endif$
$if(verbatim-in-note)$
\VerbatimFootnotes % allow verbatim text in footnotes
$endif$
Binary file added ansible-for-devops.epub
Binary file not shown.
22 changes: 11 additions & 11 deletions chapter13.txt
Original file line number Diff line number Diff line change
Expand Up @@ -52,15 +52,15 @@ As an extremely basic example, here are two of the ways I normally use debug whi

tasks:
- name: Register the output of the 'uptime' command.
command: uptime
ansible.builtin.command: uptime
register: system_uptime

- name: Print the registered output of the 'uptime' command.
debug:
ansible.builtin.debug:
var: system_uptime.stdout

- name: Print a message if a command resulted in a change.
debug:
ansible.builtin.debug:
msg: "Command resulted in a change!"
when: system_uptime is changed
```
Expand Down Expand Up @@ -111,16 +111,16 @@ Both `fail` and `assert`, when triggered, will abort the playbook run, and the m

tasks:
- name: Fail if conditions warrant a failure.
fail:
ansible.builtin.fail:
msg: "There was an epic failure."
when: should_fail_via_fail

- name: Stop playbook if an assertion isn't validated.
assert:
ansible.builtin.assert:
that: "should_fail_via_assert != true"

- name: Assertions can have contain conditions.
assert:
ansible.builtin.assert:
that:
- should_fail_via_fail != true
- should_fail_via_assert != true
Expand Down Expand Up @@ -163,11 +163,11 @@ Let's build an example playbook, and lint it to see if there are any errors:

tasks:
- name: Register the output of the 'uptime' command.
command: uptime
ansible.builtin.command: uptime
register: system_uptime # comment

- name: Print the registered output of the 'uptime' command.
debug:
ansible.builtin.debug:
var: system_uptime.stdout

```
Expand Down Expand Up @@ -238,11 +238,11 @@ Let's take the following playbook, for example (called `main.yml`):
connection: local

tasks:
- shell: uptime
- ansible.builtin.shell: uptime
register: system_uptime

- name: Print the registered output of the 'uptime' command.
debug:
ansible.builtin.debug:
var: system_uptime.stdout
```

Expand Down Expand Up @@ -759,7 +759,7 @@ Finally, we come to the meat of the workflow job, the `steps` that run once the
python-version: '3.x'

- name: Install test dependencies.
run: pip3 install ansible molecule molecule-plugins[docker] yamllint ansible-lint
run: pip3 install ansible-core molecule molecule-plugins[docker] yamllint ansible-lint

- name: Run Molecule tests.
run: molecule test
Expand Down
Loading