<?xml version="1.0" encoding="utf-8" standalone="yes"?>
<oembed>
  <author_name>akira6592</author_name>
  <author_url>https://blog.hatena.ne.jp/akira6592/</author_url>
  <blog_title>てくなべ</blog_title>
  <blog_url>https://tekunabe.hatenablog.jp/</blog_url>
  <categories>
    <anon>ansible</anon>
  </categories>
  <description>はじめに Ansible には、パス文字列からディレクトリを抽出するための ansible.builtin.dirname というフィルターがあります。 正規表現などのパターンマッチングするより、こういう専用のフィルターがあるならそれを使うのが良いかなと思います。 応用すると、ファイルからみて親の親の親の・・ディレクトリ名を抽出できたりもします。 簡単ですが検証結果をまとめます。 検証環境 ansible-core 2.16.0 サンプル --- - hosts: localhost gather_facts: false connection: local vars: # 対象のパス文字列 …</description>
  <height>190</height>
  <html>&lt;iframe src=&quot;https://hatenablog-parts.com/embed?url=https%3A%2F%2Ftekunabe.hatenablog.jp%2Fentry%2F2024%2F01%2F12%2F201214&quot; title=&quot; [Ansible] パス文字列からディレクトリ名や親ディレクトリ名を遡って抽出する - てくなべ&quot; class=&quot;embed-card embed-blogcard&quot; scrolling=&quot;no&quot; frameborder=&quot;0&quot; style=&quot;display: block; width: 100%; height: 190px; max-width: 500px; margin: 10px 0px;&quot;&gt;&lt;/iframe&gt;</html>
  <image_url></image_url>
  <provider_name>Hatena Blog</provider_name>
  <provider_url>https://hatena.blog</provider_url>
  <published>2024-01-12 20:12:14</published>
  <title> [Ansible] パス文字列からディレクトリ名や親ディレクトリ名を遡って抽出する</title>
  <type>rich</type>
  <url>https://tekunabe.hatenablog.jp/entry/2024/01/12/201214</url>
  <version>1.0</version>
  <width>100%</width>
</oembed>
